Home > Enterprise >  New Apache Installation on Ubuntu: Only localhost and 127.0.0.1 work
New Apache Installation on Ubuntu: Only localhost and 127.0.0.1 work

Time:02-04

Following a couple of tutorials, trying to install Apache on Ubuntu for the first time. In the browser, entering both localhost as well as 127.0.0.1 successfully hits the Apache Default Page, ie. "It Works".

However, when entering my public IPv4,the browser just times out.

Don't think it's the Firewall, as I did this:

sudo ufw allow http

sudo ufw allow https

sudo ufw reload

Could it be a router issue? Looked at a couple of tutorials and I don't think I'm missing any steps.

CodePudding user response:

You don't have a good understanding of IP networks.

You should research NAT, then you will understand why sending a get request to your public IP address never gets a response.

If you want to make it work with the public IP address, you should research port forwarding.

Try accessing Apache on 127.0.0.2 or 127.0.0.3 or 127.0.0.4 that will really blow your mind....

CodePudding user response:

You cannot access your web server from your public IP address because:

  1. Your ISP (Internet Service Provider) does not forward your computer's connection to the public IP address. This might happen because the IP address is shared between multiple users of the ISP, or they don't want people to use it for spam.
  2. You have a unique IP address assigned just for you from your ISP, but you haven't yet forwarded your ports.

If you haven't yet contacted your ISP, and you have a residential plan, you are probably having the [1] issue.

If you have contacted your ISP, and they have assigned you an IP address (which does not seem so from your question), you are probably having the [2] issue.

If you don't know anything about the above, its best to contact your ISP and request a "Static IP address" which is an IP address uniquely assigned only to you, and it doesn't change every few minutes/hours.

  •  Tags:  
  • Related