./configure --prefix=/opt/nginx
make && make install
2. 修改配置文件/opt/nginx/conf/nginx.conf
在server元素前增加:(假设两个tomcat的端口都是8080)
upstream www.server110.com {
server 192.168.1.13:8080;
server 192.168.1.14:8080;
}
将server元素下的server_name改为实际域名,例如:
server_name www.server110.com
在location元素下面增加一行:
proxy_pass www.server110.com
3. 启动停止命令
启动:/opt/nginx/sbin/nginx
快速停止:/opt/nginx/sbin/nginx -s stop
完整有序停止:/opt/nginx/sbin/nginx -s quit
重新加载:/opt/nginx/sbin/nginx -s reload