将apache服务的端口号修改为8080,主页选取为abc1.html
[root@server1 ~]# vim apache.sh
#!/bin/bash
#apache主页选取
dir=/var/www/html
test=web
config="/etc/httpd/conf/httpd.conf"
cd $dir
if [ ! -e abc1.html ] ;then echo $test > abc1.html
fi
sed -i -e 's/Listen 80/Listen 8080/g' $config
sed -i -e 's/DirectoryIndex index.html/DirectoryIndex fuyang1.html/g' $config
systemctl start httpd
netstat -anpt | grep httpd
[root@server1 ~]# chmod +x apache.sh
[root@server1 ~]# ./apache.sh
tcp6 0 0 :::8080 :::* LISTEN 56876/httpd