首页 > 其他 > 详细

Nginx转发

时间:2015-11-13 00:43:19      阅读:629      评论:0      收藏:0      [点我收藏+]
编辑nginx.conf文件,如下:
 
    upstream mywebs {
        ip_hash;
        server   192.168.1.11:8088; #要转发去的地址和端口
    }

    server {
        listen       8088;
        server_name  localhost;

        location ~ ^/nginx_status {
            stub_status on; #Nginx状态监控配置
            access_log  off;
            allow 127.0.0.1; #设置为可访问该状态信息的ip
            deny all;
        }
    location / {
            proxy_pass                 http://mywebs;
            proxy_redirect            off;
            proxy_set_header       Host $host:8088;   #这里的端口要和listen的值一样
            proxy_set_header           X-Real-IP $remote_addr;
            proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size     100m;
            access_log         off;
        }
 }

Nginx转发

原文:http://www.cnblogs.com/bootoo/p/4960686.html

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