nginx負載均衡簡單配置
在http中配置 www.2cto.com
Java代碼
upstream test{
server 127.0.0.1:8082;
server 127.0.0.1:8081;
}
並引入
Java代碼
include /etc/nginx/vhosts_conf/*.conf;
www.2cto.com
在vhosts_conf下的conf文件中
Java代碼
server {
listen 808;
server_name www.test.com;
index index.jsp index.html index.htm;
root /home/www/test.com;
location / {
proxy_pass http://test;
}
}