• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Resolved How to get ip address with apache listening to localhost

TorbHo

Regular Pleskian
Hello,

we used the command
Code:
plesk bin apache --listen-on-localhost true
as described in https://support.plesk.com/hc/en-us/articles/17793065826839

After that we have problems, because some code needs to get the visitor's ip address with PHP
Code:
$_SERVER[ 'REMOTE_ADDR' ]
or with .htaccess
Code:
Allow from xxx.xxx.xxx.xxx

Is there a solution or workaround to get the visitor's ip address when apache is listening to localhost?
 
I tried the solution for
Server-wide solution with Apache only
but I get the error
Code:
/etc/httpd/conf/httpd.conf dir or file not found

If I understand correctly, if I could do that, I had to add:
Code:
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 127.0.0.1
into a new file like:
Code:
/etc/httpd/conf.d/localhost.conf
Is that correct?
 
I'm sorry, I posted to the wrong location. This thread belongs to Plesk Obsidian for Linux, not Onyx.
If you are on Debian/Ubuntu it can be /etc/apache2 instead of /etc/httpd.
Yes, it is Ubuntu. Thank you, I will try it.
 
I have blocked ports 7080 and 7081 in the Plesk Firewall. To me, this seems to be a better solution and so far, I haven't encountered any problems with it.

Have I overlooked something? Is there any reason not to block these ports in the firewall?
 
Back
Top