# 502 bad gateway when accessing my domain

**URL:** <https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362>\
**Category:** Installation\
**Created:** [January 8, 2023, 1:49pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362 "2023-01-08T13:49:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnSavern](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johnsavern/32/21041_2.png) [@JohnSavern](https://forum.ghost.org/u/JohnSavern)\
**Post date:** [January 8, 2023, 1:49pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/1 "2023-01-08T13:49:22Z")

</div>

I have an 502 bad gateway error when accessing www.\<my\_domain\>/ghost  
Ghost-CLI version: 1.24.0  
Installed Ghost version: v5.28.0  
Node.js version - found v16.17.0

I have followed [this tutorial](https://stackoverflow.com/questions/46311656/what-is-the-cause-of-the-502-bad-gateway-after-ghost-1-8-7-update) and my port numbers in my ghost’s **config file** and the **proxy\_pass** in ghost site’s nginx configuration files match.

In `/var/www/ghost/config.production.json` I can see:  
“port”: 2368,  
“host”: “127.0.0.1”

In `/etc/nginx/sites-available/<my_domain>.com-ssl.conf` and `/etc/nginx/sites-available/<my_domain>.com.conf` - both have:  
proxy\_pass [http://127.0.0.1:2368](http://127.0.0.1:2368);

This is a fresh Ghost install, I have just added A-records and configured SSL with an email. My next step was to access www.\<my\_domain\>/ghost to create an admin.

Also, here is the `netstat -plotn` output:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/5/3/53feba6781e20bcb42cf471540ce4c249986eb77.jpeg)

I’m a newbie in Ghost, please, help

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 8, 2023, 2:08pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/2 "2023-01-08T14:08:51Z")

</div>

Unless it’s below your cropped image, Ghost isn’t running. What’s the output of ‘ghost ls’ in the terminal window?

---

<div class="post-metadata">

**Author:** ![JohnSavern](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johnsavern/32/21041_2.png) [@JohnSavern](https://forum.ghost.org/u/JohnSavern)\
**Post date:** [January 8, 2023, 4:04pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/3 "2023-01-08T16:04:24Z")

</div>

@Cathy_Sarisky you are right, it’s not running. The image is not cropped.  
This is the output of the `ghost start`:

```auto
+ sudo systemctl is-active <my_domain>
✔ Checking system Node.js version - found v16.17.0
✔ Ensuring user is not logged in as ghost user
 Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_<my_domain>
✔ Validating confi
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencie
✔ Checking systemd unit file
✔ Checking systemd node version - found v16.17.0
+ sudo systemctl start <my_domain>
+ sudo systemctl stop <my_domain>
✖ Starting Ghost: <my_domain>
A GhostError occurred.
Message: Ghost was able to start, but errored during boot with: Access denied for user 'root'@'localhost' (using password: YES)
Help: Unknown database error
Suggestion: journalctl -u ghost_<domain_name>-com -n 50

Debug Information:
    OS: Ubuntu, v22.04.1 LTS
    Node Version: v16.17.0
    Ghost Version: 5.28.0
    Ghost-CLI Version: 1.24.0
    Environment: production
    Command: 'ghost start'

```

the output of the `ghost ls`:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/2/3/237eb2c46f5a0fa092c71e04722c71a8f4a4914c.png)

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 8, 2023, 4:38pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/4 "2023-01-08T16:38:04Z")

</div>

Right. This isn’t a gateway problem. This is a ‘ghost isn’t running’ problem. Your problem is right here:

> [@JohnSavern](#):
>
> ```auto
> Message: Ghost was able to start, but errored during boot with: Access denied for user 'root'@'localhost' (using password: YES)
> 
> ```

Do you have the MySQL password wrong?

---

<div class="post-metadata">

**Author:** ![JohnSavern](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johnsavern/32/21041_2.png) [@JohnSavern](https://forum.ghost.org/u/JohnSavern)\
**Post date:** [January 8, 2023, 4:48pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/5 "2023-01-08T16:48:07Z")

</div>

@Cathy_Sarisky I have never set MySQL password and don’t remember the system asked me to. Only SSH keys. Is there a way to check if it is set?

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 8, 2023, 5:01pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/6 "2023-01-08T17:01:11Z")

</div>

It’s possible. It’s frankly a pain in the rear. If this is a fresh install, I’d start over! :)

---

<div class="post-metadata">

**Author:** ![JohnSavern](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/johnsavern/32/21041_2.png) [@JohnSavern](https://forum.ghost.org/u/JohnSavern)\
**Post date:** [January 10, 2023, 5:12pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/7 "2023-01-10T17:12:30Z")

</div>

@Cathy_Sarisky I think it is because of the error during installation.  
I install Ghost from the [DigitalOcean Marketplace](http://marketplace.digitalocean.com/apps/ghost). The only input that was required from me so far is domain name. This is an error:

```auto
✔ Setting up "ghost" system user
✖ Setting up "ghost" mysql user

```

What are my next steps?

Also, right after self-installation process it tries to start and:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/d/8/d89cf4a129287630177dd0e0baec881730c360af.jpeg)

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 10, 2023, 5:40pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/8 "2023-01-10T17:40:07Z")

</div>

If it were me and this was a brand new droplet I didn’t have anything invested in, I’d spin up a new droplet and see if the one-click install ran correctly on the second try.

Then I’d hope for someone on the forum with more DO droplet experience than _me_ to help out. 🙂

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [January 10, 2023, 6:01pm UTC](https://forum.ghost.org/t/502-bad-gateway-when-accessing-my-domain/35362/9 "2023-01-10T18:01:28Z")

</div>

I’d do it this way, too. Deleting the droplet and trying again is going to be far easier and quicker than trying to debug this issue.
