502 Bad Gateway nginx/1.10.0 (Ubuntu)

October 16, 2016 20.8k views
Nginx Apache Server Optimization Let's Encrypt


I had some help setting up the servers for my site first time around. Everything was working great, I was pushing all changes to the site from github with no issues. I have letsencrypt working on the site.

We got this email from Digital Ocean: “We’ve had to reboot your Droplet as a result of an issue with the physical node that hosts your Droplet. We will continue to investigate the health of this physical node to determine if this was an isolated or systemic issue.

No action is required on your part at this time and we apologize for any troubles this may have caused.”

Ever since I got this email the site has been down and everything I do can’t get it back up. It is a simple bootstrap site and the issues have to be in the server.

Has anyone dealt with this before and have a fix for it?

My server:

server {
servername example.com;
return 301 $scheme://example.com$request

server {
listen 443 ssl;

server_name www.example.com example.com;

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header upgrade $http_upgrade;
    proxy_set_header connection 'upgrade';
    proxy_set_header host $host;
    proxy_cache_bypass $http_upgrade;


 location ~ /.well-known {
            allow all;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA25$
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security max-age=15768000;


server {
listen 80;
servername example.com example.com;
return 301 https://$host$request

Digital Ocean sent me this link with some walk throughs to trouble shoot the server: https://www.digitalocean.com/community/tutorials/how-to-troubleshoot-common-site-issues-on-a-linux-server

I went through these and wasn’t able to get it turned on.

Thank you!

1 comment
3 Answers

The issue seems to be on connecting to http://localhost:3000, check if the port is open and working.

wget http://localhost:3000

If you can’t connect to port 3000, neither can nginx.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!