Getting error 502 after upgrade

Hello,

My Ghost has not been accessible after I updated to 4.37.0. I tried a lot of checking and restart, but none of it helped.

Additionally, the config files are pretty much untouched since I deployed that droplet ~2 years ago. I never had problems when I updated Ghost from 3.x to 4.x. It’s just the update from 4.3.x to 4.37.0 that broke the access.

  • What’s your URL? https://kana.ph
  • What version of Ghost are you using? 4.37.0
  • What configuration? DigitalOcean 1-click – using cloudflare
  • What browser? Firefox / Chrome
  • What errors or information do you see in the console? No errors in the console
  • What steps could someone else take to reproduce the issue you’re having? Go to my URL

Additional Info –

ghost doctor result:

✔ Checking system Node.js version - found v16.14.0
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_www-kana-ph
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.14.0

ghost status result:

+ sudo systemctl is-active ghost_www-kana-ph
┌─────────────┬────────────────┬─────────┬──────────────────────┬─────────────────┬──────┬─────────────────┐
│ Name        │ Location       │ Version │ Status               │ URL             │ Port │ Process Manager │
├─────────────┼────────────────┼─────────┼──────────────────────┼─────────────────┼──────┼─────────────────┤
│ www-kana-ph │ /var/www/ghost │ 4.37.0  │ running (production) │ https://kana.ph │ 2368 │ systemd         │
└─────────────┴────────────────┴─────────┴──────────────────────┴─────────────────┴──────┴─────────────────┘

Netstat Result:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1127/master         
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      5100/nginx: master  
tcp        0      0 127.0.0.1:2368          0.0.0.0:*               LISTEN      5770/node           
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      939/mysqld          
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5100/nginx: master  
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      669/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      866/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1127/master         
tcp6       0      0 :::443                  :::*                    LISTEN      5100/nginx: master  
tcp6       0      0 :::80                   :::*                    LISTEN      5100/nginx: master  
tcp6       0      0 :::22                   :::*                    LISTEN      866/sshd            
udp        0      0 127.0.0.53:53           0.0.0.0:*                           669/systemd-resolve

Nginx kana.ph.conf content:

server {
    listen 80;
    listen [::]:80;

    server_name kana.ph;
    root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368;
        
    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 50m;
}

Nginx kana.ph-ssl.conf content:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name kana.ph;
    root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    ssl_certificate /etc/letsencrypt/kana.ph/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/kana.ph/kana.ph.key;
    include /etc/nginx/snippets/ssl-params.conf;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass https://127.0.0.1:2368;
        
    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 50m;
}

Everything looks good when checked, but the server responds 502 when accessed directly. I tried accessing with cloudflare and without.

Anything else should I look into?

Is nginx running? What’s the output of journalctl -xe?

Yup, nginx is running:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-03-04 10:20:36 UTC; 43min ago
     Docs: man:nginx(8)
  Process: 5085 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 5097 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 5086 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 5100 (nginx)
    Tasks: 2 (limit: 1151)
   CGroup: /system.slice/nginx.service
           ├─5100 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─5103 nginx: worker process

As for the journalctl -xe, it mostly shows my ssh logs and some low-level stuffs. I can’t see anything about nginx or ghost or node.

This should be http.

1 Like

Thanks a lot!

This really fixed the problem!

1 Like