##HTTP自动化部署

#!/bin/bashe

echo "=========开始检测是否为本地源========"

aa=`ls /etc/yum.repos.d/ | wc -l `

if [[ $aa == 1 ]]

then

echo "您现在是本地源"

touch /mnt/sr0

umount /dev/sr0

mount /dev/sr0 /mnt/sr0

else

echo "您现在是网络源"

fi

sleep 3

echo "接下来开始下载httpd服务"

yum clean all

yum -y install httpd

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

sleep 3

read -p "========开始更改主机名,关闭远程连接,重新连接即可生效例:www.sbl.com========" aa

hostnamectl set-hostname ${aa}

hostname ${aa}

sleep 3

#本机IP地址输入进去进入hosts开始解析

read -p "========开始静态解析文件例:192.168.141.129 www.sbl.com========" bb

echo ${bb} >> /etc/hosts

sleep 3

echo "========开始配置httpd配置文件========"

cat /etc/httpd/conf/httpd.conf

#以后公司配置HTTPD脚本时候有域名的时候直接将localhost该为公司的域名就可以完成配置了

sed -i 's/#ServerName www.example.com:80/ServerName localhost:80/' /etc/httpd/conf/httpd.conf

echo "========查看httpd进程======="

sleep 3

ps -ef | grep httpd

echo "========查看端口是否开启========"

sleep 3

lsof -i:80

echo "========查看端口运行是否正常========"

sleep 3

netstat -anptul | grep 80

#配置完事进入/var/www/html下创建文件开始写入代码(没有运维什么事情了)

发表评论

相关文章