首页 > 其他 > 详细

nginx负载均衡配置

时间:2018-05-07 11:43:39      阅读:209      评论:0      收藏:0      [点我收藏+]
修改nginx安装目录:

/data/nginx-1.8.1/conf/nginx.conf文件

修改如下:

 server {
        listen       80;
        server_name  localhost1;

        #charset koi8-r;
        #
        #        #access_log  logs/host.access.log  main;
        #
         location / {
              # root   html;
              # index  index.html index.htm;
              proxy_pass http://192.168.1.39:8080;
         }

     }

    server {
        listen       80;
        server_name  localhost2;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
           # root   html;
           # index  index.html index.htm;
           proxy_pass http://192.168.1.39:8081;
         }

然后访问 http://localhost:80   就可以访问 8080   和 8081 2个端口来回负载

nginx负载均衡配置

原文:http://blog.51cto.com/hackerxian/2113451

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