0
Nginxをフロントエンド、Apache 2.4をバックエンドとするFreeBSDサーバーを使用しています。すべての作業は正常ですが、Apacheは[REMOTE_ADDR]を検出できません。代わりにサーバーのIPアドレスが表示されます。Apacheは[REMOTE_ADDR]を特定できません
server {
server_name example.com www.example.com;
listen 80;
disable_symlinks if_not_owner from=$root_path;
index index.php;
set $root_path /home/user/example.com/public_html;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
error_page 404 = @fallback;
}
location/{
proxy_pass http://localhost:81;
proxy_redirect http://localhost:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass http://localhost:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
:私はhttpd.confの
LoadModule remoteip_module libexec/apache24/mod_remoteip.so
変更
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
を有効にし、nginxのconfに
アパッチ
にnginxのからIPを送信しようと私の問題を解決するためにしかし、成功する。
Apacheで 'RemoteIPHeader'を設定しましたか? –