1、前置知识点
1.1 httpd nginx基本使用、配置文件
1. 主配置文件
1) [root@master ~]# rpm -ql httpd |grep conf
/etc/httpd/conf/httpd.conf
[root@master ~]# rpm -ql nginx |grep conf
/etc/nginx/nginx.conf
/etc/nginx/nginx.conf.default
2.项目部署首页文件位置
[root@master ~]# find / -name index.html
/usr/share/nginx/html/index.html
/var/www/html/index.html
1.2 非交互式编辑文本
1. [root@master ~]# echo hello > index.html
[root@master ~]# cat index.html
hello
2.替换内容
[root@master ~]# sed -i 's/hello/hello world/' index.html
###-i 修改; s是替换
[root@master ~]# cat index.html
hello world
3. 添加新行内容
[root@master ~]# sed -i '1i good luck' index.html
[root@master ~]# cat index.html
good luck
hello world
###1i 在第一行添加内容
1.3 httpd 使用其他非标端口
[root@serverb ~]# vi /etc/httpd/conf/httpd.conf
Listen 81
[root@serverb ~]# systemctl restart httpd
1.4 负载均衡的配置(使用Nginx作为负载均衡器