Question

SSH works but web server and ping do not

Posted December 17, 2019 482 views
NginxDNSFirewallUbuntu 18.04

I just transferred DNS for my domain to DO. I also setup Nginx and ensured that it was allowed through ufw. I can ssh into my server but for some reason, the website does not load and I cannot ping the server. I thought DNS transfer might take some time but even using the IP in the browser, it just times out. I can ssh into it using the domain name so I know that is setup properly.
Any suggestions?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

Hi @prask5,

It seems like your Nginx service is not running properly. In order to check that, please enter your droplet and type in the following

service nginx status

It’s highly probable it’s not actually working. It will say something along the lines of failed. If it has, try to start it again by doing

service nginx start

If it fails, you can check why it does in your journalctl by doing so

journalctl -xe

Another source of information would be your nginx error_log which should be located in your Nginx folder - /etc/nginx/

Regards,
KDSys

  • Excuse me for the second reply however I just though of something else,

    It’s possible you haven’t configured Nginx to listen on port 80 and 443 which are the default ports when opening a website via your browser.

    If your Nginx service is active, you can check on which port is listening by typing in

    netstat -tulpen
    

    It will show all service currently running and the port they are listening to. I don’t have a droplet configured with Nginx at the moment however you’ll see something like this

    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      111        3388764    5122/mysqld         
    tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      101        24589      2219/systemd-resolv 
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          5337664    17960/sshd          
    tcp6       0      0 :::80                   :::*                    LISTEN      0          4738785    2418/apache2        
    tcp6       0      0 :::22                   :::*                    LISTEN      0          5337675    17960/sshd          
    tcp6       0      0 :::443                  :::*                    LISTEN      0          4738789    2418/apache2        
    udp        0      0 127.0.0.53:53           0.0.0.0:*                           101        24588      2219/systemd-resolv 
    

    However in your case instead of Apache2 it should state Nginx.

    If Nginx is not listening on port 80(http) and 443(https) you’ll need to edit your Nginx configuration to make it so.

    Regards,
    KDSys

    • Hello, thank you. I checked and that is also enabled. It shows exactly the line you have except it is for nginx master process. It also has the same line for local address 0.0.0.0:80

Hello, thank you. The journalctl -xe did not show any issues with nginx.

Nginx status was active and didn’t report any errors. The nginx error log was blank. I tried the ‘sudo nginx -t’ command and it said that the configuration files are successful.

I do have an access block setup for another website and checked that the configuration there is also correct. I disabled it in in my /etc/nginx/sites-enabled and reloaded the webserver, still didn’t load my default site.

I finally restarted nginx and still no luck.

Visiting the website internally from behind the firewall does still work.

OK, I solved the issue. I had a firewall on my Droplet.
This thread helped me consider that also: https://www.digitalocean.com/community/questions/website-cant-be-reached

Submit an Answer