502 Bad Gateway after Ghost one-click install

February 2, 2019 2.3k views
Ghost Ubuntu

Hi,

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?

Thanks!

1 Answer

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

https://thestuffspace.nyc3.cdn.digitaloceanspaces.com/125ED004-C49C-4F4A-BF1F-8C0C4482DE4C.png

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:

https://www.digitalocean.com/docs/one-clicks/ghost/

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:

https://help.ghost.org/

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 www.writingwhilenoodles.com … that seems to have worked).

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

    When visiting https://www.writingwhilenoodles.com everything is as it should be,

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

    • Yes, your certificate is only for www.writingwhilenoodles.com as per this check:

      https://thestuffspace.nyc3.cdn.digitaloceanspaces.com/0FEEBEEA-4F9D-478E-8CE6-B960398A53BE.png

      If you switch to a wildcard certificate for *.writingwhilenoodles.com 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 www.writingwhilenoodles.com, I need to set it up as the wildcard, like you mentioned?

        So I should first use, ghost config url *.writingwhilenoodles.com, 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:

          https://forum.ghost.org

          • 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 https://my-second-domain.com
            
            # 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 https://my-canonical-domain.com
            
            # 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 https://my-canonical-domain.com$request_uri;
            
            # Get nginx to verify your config
            sudo nginx -t
            
            # Reload nginx with your new config
            sudo nginx -s reload
            
          • Glad you got there!

Have another answer? Share your knowledge.