首页 > 其他 > 详细

nginx 根据端口不同实现负载均衡

时间:2017-02-14 21:59:36      阅读:285      评论:0      收藏:0      [点我收藏+]
 upstream www.abc.com {
server www.mynginx.com:91;
server www.mynginx.com:92;
}
server {
listen 80;
server_name www.mynginx.com;
location / {
root D:/www/mynginx;
index index.html index.htm index.php;
proxy_pass http://www.abc.com;
proxy_set_header X-Real-IP $remote_addr;
}
location ~ \.php$ {
root D:/www/mynginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 91;
server_name www.mynginx.com:91;
location / {
root D:/www/nginx01;
index index.html index.htm index.php;

}
location ~ \.php$ {
root D:/www/nginx01;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 92;
server_name www.mynginx.com:92;
location / {
root D:/www/nginx02;
index index.html index.htm index.php;
}
location ~ \.php$ {
root D:/www/nginx02;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

nginx 根据端口不同实现负载均衡

原文:http://www.cnblogs.com/lixiuyuan999/p/6399219.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!