B
B
b0n3Z2011-02-01 01:38:18
Nginx
b0n3Z, 2011-02-01 01:38:18

How to get the user's IP if the server is behind a router?

Given:
- Router on dd-wrt with full access.
- Server with nginx behind a router.
Forwarded the webserver port. I look at the nginx logs - $remote_addr is written there, and this parameter is equal to the IP of the router.
Is there any way to find out the real IP of the caller?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shadowalone, 2011-02-01
@b0n3Z

In my opinion, the comrade who unsubscribed above did not understand the essence.
the port is forwarded on the router with dd-wrt (iptables), that is, your web server will not receive a real address in any way, be it at least Apache, at least Engenks, at least something else.
So don't bother.
In your case, the output is this - only if possible, put a proxy on dd-wrt redirecting to your internal web server. But this is if your router allows.

R
r0ster, 2011-02-01
@r0ster

If it's nginx+apache2, is mod_rpaf enabled?
Debian, enable mod_rpaf:
# a2enmod rpaf
If not installed, install:
# aptitude install libapache2-mod-rpaf
Then /etc/apache2/httpd.confadd: Restart Apache2: or
RPAFenable On
RPAFsethostname Off
RPAFproxy_ips 127.0.0.1 тут_пишем_свой_ip

# /etc/init.d/apache2 restart
# apache2ctl restart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question