Tag Archives: proxy

Nginx: set REMOTE_ADDR to HTTP_X_FORWARDED_FOR

I use apache2 as frontend proxy (on the gateway) and nginx as backend (on the internal host).
Apache sends its IP as REMOTE_ADDR and IP of client as HTTP_X_FORWARDER_FOR.
Statistics of unique IPs in my blog was destructed, but I found solution.
In the nginx settings set option AFTER include:
1
location ~ .php$ {
1
    
1
fastcgi_pass 127.0.0.1:9000;
1
    

1
include fastcgi.conf;
1
    

1
fastcgi_param REMOTE_ADDR $http_x_forwarded_for;
1
}

ssh: reverse socks proxy

I have schema:

LocalNetwork (192.168.198.0/24) < — > myPC < — > GATE < — > RemoteNetwork (10.0.0.0/24)

In the LocalNetwork i have web-server (192.168.198.68)

myPC# ssh -D 1080 -R127.1:1080:127.1:1080 myPC ssh -R127.1:1080:127.1:1080 GATE ssh -R127.1:1080:127.1:1080 root@10.0.0.16

10.0.0.16# curl --socks4 127.0.0.1:1080 http://192.168.198.68

<html>

...

</html>