2

I have installed a fresh Apache with a fresh Ubuntu server. I did not make any changes to my server yet. The default Apache website is visible from other PCs inside the private network.

The ports 80 and 22 are forwarded properly to the server, and I have setup a fixed IP DHCP 192.168.10.116 from my router.

SSH is accessible from public or private network. But the website is only accessible from the private network. I would like to make the website available to the world.

Note that I have tried this setup with a Windows PC + XAMMP, from which the default Apache webpage had been visible from a public IP.

Below are some details:

mg@node1:~$ sudo ufw status
Status: inactive
mg@node1:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
mg@node1:~$ cat /etc/apache2/ports.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
mg@node1:~$ sudo netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      702/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      780/sshd
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      1039/sshd: mg@pts/0
tcp6       0      0 :::80                   :::*                    LISTEN      2340/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      780/sshd
tcp6       0      0 ::1:6010                :::*                    LISTEN      1039/sshd: mg@pts/0
mg@node1:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 node1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
mg@node1:~$ curl http://192.168.10.116
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML ... ...
mg@node1:~$ curl http://43.xxx.xxx.95
curl: (7) Failed to connect to 43.xxx.xxx.95 port 80: Connection refused

My router port forwarding record

  • 3
    You might want to check with your ISP if they block port 80. – Terrance Oct 2 at 13:28
  • @Terrance The ports are unblocked and from windows10+xammp the website was available through port 80. But I am so confused, why its not working in ubuntu+apache2. – MJC Oct 2 at 13:33
  • 1
    Change Listen 0.0.0.0:80 to simply Listen 80 and report back. – AlexP Oct 2 at 14:27
  • 1
    @Terrance >> You might want to check with your ISP if they block port 80. You are right I check with the other port such 8017 its works fine except 80. Contacted with the ISP to unblock it. Thank you again. – MJC Oct 3 at 9:39
  • 1
    @Terrance I am scared to say that my the port forwarding rules was incorrect with the Mikrotik(except the 8017 port), after correct it the website is visible to the world. Thank you all! – MJC Oct 7 at 11:53

Your Answer

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

Browse other questions tagged or ask your own question.