Apache server redirects to localhost

I’m a newbie to site hosting. I’m trying to host a website on my raspberry pi using apache.

I got a dynamic DNS host and set my router so it forwards TCP port 80 to my pi.

The problem is, when I try to browse my site from no matter the internet or the LAN, it always “tries to” redirect me to the localhost IP address which is 192.168.0.18, causing the site inaccessible over the internet.

Example:
Actions are done when I’m outside of the LAN which the server is on
Type in browser : (my dynamic DNS host>
the address bar of the browser becomes 192.168.0.18

traceroute (my dynamic DNS host>
my public IP shows up

ping (my dynamic DNS host>
my public IP shows up but no response from the server

This is really confusing because I am also running owncloud server on my pi, when I try to access (my dynamic DNS host>/owncloud, this doesn’t happen and my actual owncloud page shows up.

Later on I completely removed owncloud and wordpress,etc. leaving only apache running and try to access (my dynamic DNS host> over the internet, the same thing happens — the local IP shows up.
So I think that I’ve done something wrong with Apache. Does anyone know this happened and how to fix it?
Many thanks.

Read more here: Apache server redirects to localhost

Leave a Reply

Your email address will not be published. Required fields are marked *