Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to setup a local development environment so that I can keep my development work from bogging down my VPS; leaving it for production code only. I am having trouble connecting to the server through a web browser, I continually get a "Safari cannot connect to the server" error. I have tried/established:

  • Adding ServerName to the httpd.conf file, setting it to localhost
  • In the ports.conf file, Listen is set to 80. I tried changing it to *:80

Here are the "conditions" of my situation:

  • Host OS: OSX 10.9 Mavericks
  • Guest OS: Ubuntu Server 12.04.3
  • Using Virtual Box to create the VM

I can SSH to the server just fine, but again, I cannot access the server via http in a browser.

share|improve this question
Just a few checks: Did your restart apache after modifying the configuration? Is Apache actually listening on port 80 of the server's IP address? Did you check if there's a firewall blocking port 80 to the server? – Teun Vink Dec 4 '13 at 21:50
Yes, I did restart apache. As for your second question, like I said the config file reads: "Listen 80", as far as I know, that means it is. Lastly, the firewall on my computer is not active, and I don't believe there is one on the server either considering "ufw" is not installed. – Alec Carpenter Dec 4 '13 at 21:57
Regarding 2: there can be a difference between configuration and what's actually happening. So check using lsof -i. Regarding the firewall: check with iptables -xnvL, ufw is just a wrapper. – Teun Vink Dec 4 '13 at 22:00
Executing the first command prints 8 lines, three of those lines include ":http (LISTEN)", nothing says ":80". As for the second command, chain INPUT, FORWARD and OUTPUT all say ACCEPT. – Alec Carpenter Dec 4 '13 at 22:07
ok, so apache is listening and there's no firewall. What happens when you telnet to port 80 of the server? – Teun Vink Dec 4 '13 at 22:28

I was able to figure it out, thanks to those who helped!

My solution was to add a port forwarding rule to the network settings of the virtual machine in VirtualBox. (Choose an existing virtual machine -> Settings -> Network -> Port Forwarding) Inside of port forwarding, I added a rule like: (forward to)

Now when I type into the browser, I am served the default "It Works" page. This leads me to believe that there is something blocking port 80, but if this works, I don't see a need to try and fix that.

share|improve this answer
Based on what you're now telling you were just testing it wrong. Localhost on your machine without the portforward is something different than, so of course that would not work. I assumed you tried to open in your browser (which will most likely just work) since that's the IP your server is using. – Teun Vink Dec 4 '13 at 22:57
@TeunVink I have tried that also, but I still get an "unable to connect" error. – Alec Carpenter Dec 4 '13 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .