Website not working (ssh & ping does work)

April 25, 2018 334 views
Nginx

Today I set up my site (via this tutorial). At first it was working, but now when I browse to my wesite it doesn't work anymore.

However, I am able to connect to the IP address (or via the domain), and I can ping to it. Also I know that my node.js is running and so is my NginX, because when I curl at localhost:8080 via ssh I get the proper response.

6 Answers

Are you certain that nginx is running? If you can ping, ssh and can see your site returned at port 8080 (Node's process) but cannot load your site on the default ports 80/443 (Nginx process) I would recommend restarting nginx with:

service nginx restart

and checking your logs in /var/log/nginx/error.log to see if additional information about the issue was recorded there.

  • I did the restart a couple of times, it didn't help. My log contains the following:

    2018/04/25 16:28:07 [notice] 1869#1869: signal process started
    

What does curl at localhost port 80 give? Any firewall? Selinux? When you say doesn't work, what exactly happens? Times out? 404. These details will help troubleshooting.

  • 8080 and 80 give the same response (just a simple "hello world"). When visited through the browser it says (via chrome):

    This page isn’t working
    xxx.xxx.xxx.com didn’t send any data.
    ERR_EMPTY_RESPONSE
    

You need

curl -I http://localhost:80

This will tell you the status with the http header. It's totally fine if the server sends empty response. It's the headers that matter and will help tell if the site is down or not.

  • Oh thanks. It gives me this:

    HTTP/1.1 200 OK
    Server: nginx/1.10.3 (Ubuntu)
    Date: Wed, 25 Apr 2018 18:40:25 GMT
    Content-Type: text/plain
    Transfer-Encoding: chunked
    Connection: keep-alive
    
    Hello World
    

aha. Works like a charm. Now can you do the same but use the actual IP or fqdn from your machine?

This verifies that the server is working fine. Now your app needs to send some actual data that the browser can render such as an html markup / xml / json etc.

Your backend server doesn't seem to be sending any data. Try curl -I http://localhost:8080 or opening the same in a browser. If you need help then just ping me at shivanand at converticacommerce dot com

Have another answer? Share your knowledge.