0

I have an apache2 server and have been trying to make it accessible to all but am unable to do so. Here are the outputs:

$ netstat -plant | grep apache
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN    15647/apache2

earlier it was :::80, but I changed it after seeing another post on serverfualt.com

$ ufw status
Status: inactive
$ service apache2 status
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-08-28 18:33:05 UTC; 16min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15625 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15647 (apache2)
      Tasks: 55 (limit: 4617)
     Memory: 12.5M
     CGroup: /system.slice/apache2.service
             ├─15647 /usr/sbin/apache2 -k start
             ├─15648 /usr/sbin/apache2 -k start
             └─15649 /usr/sbin/apache2 -k start

Aug 28 18:33:05 localhost systemd[1]: Starting The Apache HTTP Server...
Aug 28 18:33:05 localhost systemd[1]: Started The Apache HTTP Server.

When I try to access it from browser, it just keeps on oading and after some point gives site takes too long to respond error.

Please help me resolve it. Also if any other output will be required, please inform me.

Divyessh
  • 103
  • 3

1 Answers1

3

You already checked that the service is running.

Try to access your server from the server itself, in order to check if the service is accessible. A adequate command to check is telnet or curl, to be executed on the same machine the server is running:

$ telnet localhost 80
$ curl -v http://localhost

If this is working well, next is to check if the firewall on the server has opened port 80. Hint: ufw is just one type of firewall, there could be other programs as well. Please also check if another firewall ( for instance the one of your server provider) allows access to port 80.

Next step is to try the same, but to use the Public IP of the server. A command to know your public IP of the server is echo $(curl -s ifconfig.me). Another way is to search for it in the output of ip a.

Finally you should check the DNS, eg. if your domain name points to the correct IP.

Lutz Willek
  • 683
  • 2
  • 10