I have installed the apache web server; with MySQL and php but am unable to access the website on /var/www/html from outside using my public IP address.

I have performed port forwarding on my router for the device housing the website; but when putting in the url http://<public IP address>:8080 I receive a message saying the page cannot be found.

However if I use the url “localhost” I can see the website. What else do I need to check as clearly something has been omitted in my set up.

  • Do you have enabled firewall? – pa4080 Nov 5 '17 at 7:04
  • Would this be on the router or the ubuntu operating system; on the router, i have created pins to go out of the firewall. – TiggersThoughts Nov 5 '17 at 8:29
  • I mean on the Ubuntu operating system. – pa4080 Nov 5 '17 at 8:30
  • I’ve just found a similar issue as a response on the forum where the questionnaire was told to disable the firewall with sudo use diable; I have done this and am now able to see my website from outside; Now I need to allow through the firewall on port 80/tcp; and am not too sure of the command for this please advise. – TiggersThoughts Nov 5 '17 at 8:58
  • In short: sudo apt install ufw; sudo ufw default deny incoming; sudo ufw default allow outgoing; sudo ufw allow 80/tcp; sudo ufw enable – pa4080 Nov 5 '17 at 9:27

I would suggest you to use the tool Uncomplicated Firewall - ufw, at this state. It is easy to use front end of iptables. It's GUI version is called gufw.

1. Install the app:

sudo apt install ufw

2. Setup the default policy to deny all incoming traffic and allow all outgoing:

sudo ufw default deny incoming
sudo ufw default allow outgoing

3. Allow the incoming traffic on certain ports. For example if your Apache server listen to port 80 use this rule:

sudo ufw allow 80/tcp

Or you could use Apache's application profile:

sudo ufw allow Apache

Maybe you will want to allow the access also to the SSH port. For this case limit is better rule:

sudo ufw allow 22

Or use the default application profile for SSH:

sudo ufw allow ssh

4. Enable the firewall:

sudo ufw enable



sudo ufw status verbose will show you if the firewall is active/enabled and what if any ports are allowed/blocked.

If you forwarded port 8080 on the router, make sure that it is allowed through the firewall but also make sure that Apache is listening on port 8080. The default in /etc/apache2/ports.conf and the sites-available .conf files is port 80.

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.