Digital Ocean ghost 502 error

Hello friends,

I’m experiencing regular issue while running ghost on digital ocean server.
I’ve installed standard DO server package and it works fine, but approximately every two weeks the site goes down with the error:

502 Bad Gateway

nginx/1.14.0 (Ubuntu)

The server ir running and I didn’t a single thing. When I restart Ghost, everything goes back to normal and in two weeks I have to check up again whether my site is up.

Site URL:

I am not sure whether since you are using Standard I mean its a $5 one right? Initially I placed my platform at that server, but I noticed that its getting memory issues like for Ghost to run at least 150 MB is needed. But during that downtime I checked there were only MB below that level so Ghost stopped.

The monitoring shows I’m using a fraction of 1 percent CPU, no idea about RAM, yet 1 GB seems to be enough.
1 GB Memory / 25 GB Disk / AMS3 - Ghost on Ubuntu 18.04

This happened to me last night too. Not sure what happened either. Thought of chiming in to watch this thread too.

It’s like that for me too.

Please include your Ghost versions when reporting unexpected behaviour - it’s in the default topic template because it helps diagnose problems.

Regarding the reported crashing, there was an issue with background jobs using up file descriptors over time which could result in this type of periodic crash, however that was fixed in Ghost 3.41.7. If you’re on an earlier version of Ghost, please upgrade.

If you’re on 3.41.7 or later, please check your Ghost logs for the period where it went offline for any error messages.

Looks like I have outdated one (Ghost version: 3.40.5)
Thanks Kevin!

I launched my site on a basic server for $ 5.
The ghost worked great.
Then I got the error

504 Gateway Time-out - the site had about 3000 users at that time.

After that I decided to increase the capacity of the server.
After that, the site stopped working.

ERR_CONNECTION_REFUSED

ghost-mgr@ghost-ubuntu-s-1vcpu-1gb-fra1-01:~ cd /var/www/ghost ghost-mgr@ghost-ubuntu-s-1vcpu-1gb-fra1-01:/var/www/ghost ghost doctor
:heavy_check_mark: Checking system Node.js version
:heavy_check_mark: Checking logged in user
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
System checks failed with message: ‘Missing package(s): nginx’
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using ghost install local instead.
? Continue anyway? (y/N)

Debug Information:
OS: Ubuntu, v18.04.4 LTS
Node Version: v12.18.0
Ghost Version: 3.42.0
Ghost-CLI Version: 1.16.0
Environment: production
Command: ‘ghost doctor’

What to do :frowning:
thank

Do you have a snapshot or backup from before you made the upgrade?

I’ve had a similar problem before. I fixed it by:

  • removing the ngnix config file in sites-available/sites-enabled folder.
  • remove the job from systemd
  • restart ngnix
  • ghost install/setup

As I understand the problem. The ngnix/systemd task has become corrupted somehow. There’s probably another way to fix it. But this takes a minute to do and works.

Thanks for the answer. There are no backups.

Please specify the path.
How do I find the config file?
Thank.
I think this should work.

The config file should under etc/nginx/sites-available etc/nginx/sites-enabled. Just go there and remove them (back them up in case)

Then you have to use systemctl to find the systemd task and remove it. The task might be called ghost_localhost

Yeah I’d recommend making snapshots before major system changes. At least you can rollback if it all goes tits-up

1 Like

Thanks, I will try.

Thanks to everyone who tried to help me.
Then you have to use systemctl to find the systemd task and remove it. The task might be called ghost_localhost
How and where to find this task?