nginx安装目录/conf/nginx.conf
./nginx -s reload
一个server就是一台虚拟主机
server {
listen 80;//监听端口
server_name localhost;//域名
location / {
root html;
index index.html index.htm;
}
}
upstream tomcat {
server ip1:端口号1 weight=2;
server ip2:端口号2 weight=2;//权重
}
server {
listen 80;//监听端口
server_name www.test.com;//域名
location / {
proxy_pass http://tomcat2;
index index.html index.htm;
}
}
原文:https://www.cnblogs.com/-saligia-/p/9749527.html