searching example config for my setup

Antoine Bonavita antoine.bonavita at gmail.com
Thu May 19 19:35:17 MSD 2011


Hello,

On Thu, May 19, 2011 at 3:46 PM, Jelle de Jong
<jelledejong at powercraft.nl> wrote:
> Dear Antoine,
>
> Thank you for taking the time to help.
>
> On 19-05-11 14:39, Antoine Bonavita wrote:
>> Did you try "proxy_set_header  X-Real-IP  $remote_addr;" ?
>
> I did, but it sill shows the IP-addr of the nginx server....
>
> server {
>    listen      80;
>    server_name sandbox01.powercraft.nl;
>    access_log  /var/log/nginx/sandbox01.powercraft.nl.access.log;
>    location / {
>        proxy_pass          http://192.168.24.63/;
>        proxy_set_header    X-Real-IP  $remote_addr;
>        proxy_set_header    Host $host;
>    }
> }
>
> # tail -n 1 /var/log/nginx/sandbox01.powercraft.nl.access.log;
> 109.32.215.197 - - [19/May/2011:15:42:41 +0200] "GET
> /themes/garland/print.css?1 HTTP/1.1" 304 0
> "http://sandbox01.powercraft.nl/admin/settings" "Mozilla/5.0 (X11; U;
> Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid)
> Firefox/3.6.15"
>
> # tail -n 1 /var/log/apache2/sandbox01.powercraft.nl/access-default.log
> 192.168.24.62 - - [19/May/2011:15:42:41 +0200] "GET
> /themes/garland/print.css?1 HTTP/1.0" 304 173
> "http://sandbox01.powercraft.nl/admin/settings" "Mozilla/5.0 (X11; U;
> Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid)
> Firefox/3.6.15"
>
> # 192.168.24.62 is the IP of the nginx server
>
> Any ideas? Tips?
Sorry, I was assuming you were doing something else with the IP in the
backend than logging. As far as I know  the default logging for Apache
uses variable %a which is always set to the other end of the socket
(sandbox01.powercraft.nl in your example). Maybe you could configure
your Apache logs to use %{X-Real-IP}i instead. There you should see
what you expect in the Apache logs.

Good luck with it,

A.

--
Take a break. Visit nginx-land: http://www.nginx-discovery.com ;)


>
> Kind regards,
>
> Jelle de Jong
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
>



More information about the nginx mailing list