1.yum -y install gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel
2.wget http://nginx.org/download/nginx-1.19.9.tar.gz tar -zxvf nginx-1.19.9.tar.gz
cd nginx-1.19.9
./configure --with-http_stub_status_module --with-http_ssl_module --with-stream
make
make install
3.启动nginx
/usr/local/nginx/sbin
命令如下
./nginx -s reload
./nginx stop
./nginx
4.nginx反向代理多个tomcat,添加如下
upstream tomcat1 {
server 192.168.0.105:17078 weight=1;
server 192.168.0.105:17079 weight=1;
}
location / {
# root html;
proxy_pass http://tomcat1;
index index.html index.htm;
}
如下图所示,upstream里配置多个tomcat的ip和端口,和权重