2016-03-24 22 views
0

'u belirleyemiyor FreeBSD sunucusunu ön uç olarak Nginx ve Apache 2.4 arka uç olarak kullanıyorum. Bütün işler gayet iyi, ancak Apache [REMOTE_ADDR] 'yi algılayamaz, bunun yerine sunucu IP adresini gösterir.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; 
     } 
} 
:

Ben Apache için Nginx dan

Nginx conf IP göndermek httpd.conf

#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 

yılında

LoadModule remoteip_module libexec/apache24/mod_remoteip.so 

değişimi sağlamak ve denemek benim sorunu çözmek için

Ancak, t başarı.

+0

Apache'de 'RemoteIPHeader 'ayarladınız mı? –

cevap

0

Nginx yapılandırması iyi görünüyor. Aşağıdakileri Apache yapılandırmanıza eklemeniz gerekebilir.

RemoteIPHeader X-Client-IP