I've just installed apache2 on my box, along with php5.

I can navigate to "localhost" and it works. But I can't access this webserver from another machine... or even locally using the IP address. Other posts such as Apache (and other services) work on localhost, but not IP address suggest firewall settings and also checking to make sure I'm listening not just on localhost but *80.

This is what I have in ports.conf:

me@mydev:/etc/apache2$ cat ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>   Listen 443 </IfModule>

<IfModule mod_gnutls.c>     Listen 443 </IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

The default firewall doesn't seem to be enabled:

me@mydev:/etc/apache2$ sudo ufw status
[sudo] password for me: 
Status: inactive

Just not sure what else I should check. Thanks.


Results from IP tables query:

me@mydev:/etc/apache2$ sudo iptables -L
[sudo] password for me: 
Chain INPUT (policy ACCEPT) target     prot opt source              

Chain FORWARD (policy ACCEPT) target     prot opt source              

Chain OUTPUT (policy ACCEPT) target     prot opt source              

And I am able to successfully ping the box from different machines.


Here are the results from the nmap command:

me@mydev:/var/www/html/test$ nmap localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2014-12-01 04:04 EST
Nmap scan report for localhost (
Host is up (0.00020s latency).
Not shown: 997 closed ports
22/tcp  open  ssh
80/tcp  open  http
631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

And for the IP:

me@mydev:/var/www/html/test$ nmap

Starting Nmap 6.40 ( http://nmap.org ) at 2014-12-01 04:08 EST
Nmap scan report for mydev.testdomain.bg.org (
Host is up (0.00024s latency).
Not shown: 998 closed ports
22/tcp open  ssh
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
  • Please edit your question with the output of sudo iptables -L. Also try to ping the ip address – Salem Nov 27 '14 at 21:47
  • What does 'nmap' gives when you run it on local host and your machines IPv4 address? Do you want to have Apache listening on IPv6? You need to have your Apache to listen to your IPv4 address, or the "listen to all address" address ''. So it isn't enough to just set the ports you want your Apache to listen for connections on. – Anders Nov 29 '14 at 4:37
  • I'm not sure what's wrong, but to clear up some confusion... you don't listen on "localhost" or your ip address, you listen only on a port which is on your machine's ip address. "localhost" is simply a shortcut for your own ip address. Also, apache will respond to connections from other computers on the lan by default, I believe. What error do you get in the browser when you try to connect? – Marty Fried Dec 1 '14 at 4:08
  • @MartyFried I'm getting a connection timed out error message for the site when i try to connect from another machine on the LAN – dot Dec 1 '14 at 14:03
  • @Anders, please see my edit which includes results from "nmap" command – dot Dec 3 '14 at 13:54

This isn't actually an answer, but it was too detailed to be a comment, and may become an answer after more information is determined.

When I read your post, I thought you were using your lan ip address (internal ip address), but after comparing the results of your commands vs my own, forcing me to look more closely, I see that you are trying to use an external public ip address.

This situation results in more variables and more complexity.

Are you using the actual ip address (xxx.xxx.xxx.xxx), or the domain name?

Is "mydev.testdomain.bg.org" the actual domain name? I don't see this in the registry at all - how are you getting the DNS?

Does your apache configuration file have the ServerName specified in the VirtualHost setup in /etc/apache2/sites-enabled?

What sort of system is this hosted on? I've seen situations with certain routers where you couldn't access a local site from the local machine using the external public ip (for example, Comcast's router).

EDIT: Also, when you make changes to your configuration, as suggested by people who may or may not have a clue about what they are suggesting, and the change does not solve your problem, do you go back and undo the change to restore the original configuration? You should either do that, or keep very good records about all the changes you've made.

| improve this answer | |
  • I'm in fact not using a public IP addy. It's just an internal address. The domain name I listed is just a fudge domain. I'm using the IP Address.... the config file doesn't have a ServerName variable defined. The machine is just a ubuntu 64 bit desktop. This is just a test system. – dot Dec 1 '14 at 18:13
  • @dot: So, why the confusing data? How did you determine the ip address? – Marty Fried Dec 1 '14 at 20:05
  • I did an ifconfig to get the IP address. Can you expand on why you think it's using an external address - just to put me on the same page? Thanks! – dot Dec 2 '14 at 18:07
  • @dot: Mostly, I was fooled by your data,where you used an external domain name. I'm not an expert on ip addresses, so it may be a local address, but I'm used to seeing either 192.168.x.x or 10.0.x.x. I wasn't sure, so that's why I asked. – Marty Fried Dec 2 '14 at 21:43
  • 1
    @Marty. Any address starting with 10.x.x.x is a private address. It is actually written, but that is usually divided into networks with 10.x.x.0./24. Same for, which is usually divided in smaller 192.168.x.0/24 nets. – Anders Dec 5 '14 at 20:23

If you are using a VM, just try restarting it!!

I had the exact same problem with the same configurations you had in a fresh install of Ubuntu. localhost was working but nothing else. A restart solved it for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.