502 Bad Gateway after Ghost one-click install

Posted February 2, 2019 5.4k views


I just tried setting up ghost using the guide for the one-click install. I followed all the steps but now when visiting my website I get the 502 bad gateway error. I’ll admit that DigitalOcean is probably a bit too technical for me, I know a bit about for instance setting up Wordpress on your own web host, but nothing like this - running Ubuntu and using SSH and stuff. Though that’s why I chose this for the one-click install.

From the guide and tutorials I’ve seen on YouTube it seems as if after setting up the one-click install the website should just work?

Could somebody help me figure out why I’m seeing the 502 Bad gateway error?


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.

Submit an Answer
1 answer

Hi friend, when you start a Ghost One-click application you’ll see this from your Droplet in about 60 seconds:

If you don’t see that Destroy the Droplet and create another. If you do it’ll take you to the Quickstart that shows you how to login and set Ghost up one time:

Once that’s done Ghost will present a screen asking for your account details IIRC, and you’re good to go.

You can also get help with the Ghost One-click application:

Hope this helps!

  • Hi! Thanks a bunch! I redid the Droplet and it seems to work now. I think the problem was that I added the domain wrong during the one-click setup. (It asked for the url, so I typed https://www.writingwhilenoodles … On the new Droplet I just typed … that seems to have worked).

    Maybe there’s one more thing you could help with?

    When visiting everything is as it should be,

    however when visiting (without the www.) I get a This connection is not private error. Any idea how to resolve this?

    • Yes, your certificate is only for as per this check:

      If you switch to a wildcard certificate for * you should be OK I think

      • I don’t want to break the Droplet again so before actually running any of these commands I would like to check if I’m making any mistakes.

        I found that you can re-do the SSL setup by running ghost setup ssl. However, it seems like the SSL is linked to the configured domain name, is that correct?

        So does that mean that instead of setting up my Ghost URL as, I need to set it up as the wildcard, like you mentioned?

        So I should first use, ghost config url *, followed by ghost restart, and then, run ghost setup ssl again.

        Is that correct?

        (Is it also correct that before changing anything in ghost, after logging in with SSL, I should run sudo -i -u ghost-mgr followed by cd /var/www/ghost?)

        Thanks for being so helpful and putting up with my lack of knowledge!

        • Ah I didn’t realize all your certificate stuff was done in Ghost itself, sorry mate! This is where I’m out of ideas I’m afraid. Ghost forum is another good user community possibly with a bit more direct knowledge:

          • Thanks for pointing me in the right direction. It’s resolved now.

            For anyone else reading this thread in the future, the solution is to (temporarily) change the Ghost URL and requesting a new SSL, and then changing back to the original URL.

            First SSH into your Droplet, then sudo -i -u ghost-mgr followed by cd /var/www/ghost, then, run these commands:

            # Determine your secondary URL
            ghost config url
            # Get Ghost-CLI to generate an SSL setup for you:
            ghost setup nginx ssl
            # Change your config back to your canonical domain
            ghost config url
            # Edit the nginx config files for your second domain to redirect to your canonical domain. In both files replace the content of the first location block with:
            return 301$request_uri;
            # Get nginx to verify your config
            sudo nginx -t
            # Reload nginx with your new config
            sudo nginx -s reload