自己上传nginx包(也可以使用压缩包的位置)
#!/bin/bash
#关闭防火墙,selinux
systemctl stop friewalld.service
setenforce 0

#安装依赖
yum -y install gcc gcc-c++ pcre-devel zlib-devel openssl-devel &>/dev/null
echo “nginx安装依赖完成!!!”

#解压
tar zxf nginx-1.12.2.tar.gz
echo “解压完成”
cd nginx-1.12.2
echo “nginx-1.12.2路径进入成功!!!”
./configure &>/dev/null
echo “环境监察ok”
make &>/dev/null
make install &>/dev/null
echo “源码安装ok”
#修改nginx界面
sed -i ‘14s/Welcome to nginx!/nginx1!!!/’ /usr/local/nginx/html/index.html
echo “nginx update ok!!!”

#nginx编辑
sed -i ‘/#gzip/a upstream webs{\n server 10.0.0.35:8080;\n server 10.0.0.35:18080;\n}’ /usr/local/nginx/conf/nginx.conf
sed -i ‘49s/index index.html index.htm;/index index.html index.jsp index.htm;/’ /usr/local/nginx/conf/nginx.conf
sed -i ‘/index index.html index.jsp index.htm;/a proxy_pass http://webs;’ /usr/local/nginx/conf/nginx.conf
echo “nginx.conf 配置文件ok”
/usr/local/nginx/sbin/nginx &>/dev/null
/usr/local/nginx/sbin/nginx -s reload
echo “nginx启动成功,请在测试页测试nginx!”

nginx负载均衡tomcat 以及安装nginx
nginx负载均衡tomcat 以及安装nginx

相关文章:

  • 2021-05-30
  • 2021-11-27
  • 2021-12-11
  • 2018-02-04
  • 2022-01-21
  • 2021-08-05
  • 2018-08-16
猜你喜欢
  • 2021-06-01
  • 2021-10-20
  • 2021-06-14
  • 2022-01-14
  • 2021-11-13
  • 2021-11-27
相关资源
相似解决方案