码迷,mamicode.com
首页 > 其他好文 > 详细

nginx负载均衡配置

时间:2018-05-07 11:51:20      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:nginx   负载   

修改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负载均衡配置

标签:nginx   负载   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!