I'm running Apache2 on Ubuntu Server 15.04. For simplicity, I removed all the routers in between. Presently, my server is directly connected to the internet. All that is there in my home network is one computer.

All I want is this -

I run curl to access website locally. Or putting in localhost in my browser should display my website.

I run curl ipecho.net/plain | curl on some other machine to access the same website. Or putting in http://<my ip addr> should let me see my website.

But unfortunately, I'm unable to do so. As of now, I can only access my webpage locally, i.e. by putting in localhost. What I can't do is view this website on the internet. I have tried on different ports(80, 72, 8090, 44346), but in vain. What am I doing wrong? All I want is to access my website over the internet.

  • I don't get why the downvote? It is definitely a valid question. Not knowing an answer is not a prerogative to vote down a question. :( Apr 26 '16 at 10:54

You stated your server is directly connected to the Internet now. Can you access websites from a browser on that server or ping outside systems successfully? E.g., does ping google.com work successfully? Can you ping your server from an external system? If you don't know the external IP address that other systems will need to use to access your server, you can determine that IP address by opening a browser on the server and visiting WhatIsMyIP.com.

If you have firewall software running on the system, e.g., iptables, you will need to configure the firewall software to allow inbound connections to port 80. For iptables, the command sudo iptables -L will show you the current firewall rules. You can allow inbound connections to port 80 with sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT or you can install the Uncomplicated Firewall (UFW) package to simplify the management of iptables firewall rules with sudo apt-get install ufw and then enable it and permit inbound port 80 connections with the following commands:

sudo ufw enable
sudo ufw allow 80

See How To Setup a Firewall with UFW on an Ubuntu and Debian Cloud Server for further information on the use of UFW.

If you do have Internet access from the server and access to it from external systems isn't being blocked by firewall software, then perhaps your issue may lie in the configuration of the Apache web server software. Check Apache's /etc/httpd/conf/httpd.conf configuration file. Look for the following line:

Listen 80 

That line will allow Apache to listen for connections to port 80 on all IP addresses for the system. If, instead, you see Listen 80, then it is only listening on the localhost address.

Do you have any section like the following in that httpd.conf file or in a virtual host file for your site in /etc/httpd/conf.d?

<Directory />
  Order Deny,Allow
  Deny from all
  Allow from

The Deny from all statement followed by the Allow from would only permit access from the localhost address.

  • pinging google from my server works. I even opened the firewall at port 80. But even then it doesn't seem to work. Pinging my server from my own server works (using public IP). But unfortunately, pinging my server from an external device didn't work. I don't get the reason. Apr 27 '16 at 12:23
  • Also all the configuration settings in apache2.conf file seems to be fine. It looks like I can't connect to my server from any other external system despite allowing the firewall. Apr 27 '16 at 12:28
  • Moonpoint, Just to make sure the ISP isn't blocking port 80, I changed it to 72. But it still doesn't work. Anybody any ideas? Apr 27 '16 at 15:19

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.