Apache rejects connection to phpmyadmin while connected to VPN on the same host?

Louis asked:

For example: I have LAMP installed on a publicly accessible server with IP 160.x.x.x along with pptpd. When connected to pptpd to the same server, Google reports my IP as 160.x.x.x which verifies that I am connected to the VPN server and the remote gateway setting on my windows machine is turned on. I furthermore updated phpmyadmin.conf to only allow the same server IP ie 160.x.x.x. While connecting to phpmyadmin I still get a forbidden message.

Apache log shows that the connection to phpmyadmin is rejected as it is not in the allow list.

Why would it detect my internet connection IP rather than the server IP because I am already connected to VPN?

My answer:

You’re running a web server on the same machine as your “VPN” server. Thus when you connect to the virtual network, that server sees your IP address as the private internal IP address that it assigns to you, not as the global IPv4 address. That private address is the address you must whitelist.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.