【问题标题】:How to set nginx reverse proxy Apache-2.4(php5_module) with mod_remoteip如何使用 mod_remoteip 设置 nginx 反向代理 Apache-2.4(php5_module)
【发布时间】:2013-11-18 14:03:03
【问题描述】:

internet -> nginx -> apache-2.4

Remote_Addr 打印 127.1.1.0 而不是客户端 ip。我在 nginx 后面有 apache,具有以下设置: nginx.conf:

location / {
        try_files $uri @apache;
        }

location @apache {
        internal;
        proxy_pass http://127.0.0.1:8080;
        include proxy.conf;
        }

location ~ .*\.(php|php5)?$  {
        proxy_pass http://127.0.0.1:8080;
        include proxy.conf;
        }

proxy.conf:

proxy_connect_timeout 300s;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 32k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';
proxy_set_header Referer $http_referer;
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

httpd.conf:

Listen 127.0.0.1:8080
Include conf/extra/httpd-remoteip.conf

httpd-remoteip.conf:

LoadModule remoteip_module modules/mod_remoteip.so
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1

【问题讨论】:

    标签: apache nginx proxy


    【解决方案1】:

    sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@" /usr/local/apache/conf/httpd.conf

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-02
      • 1970-01-01
      • 2016-08-09
      • 2016-07-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多