# Nginx error 502

**URL:** https://meta.discourse.org/t/nginx-error-502/199458
**Category:** Self-hosting
**Created:** [August 6, 2021, 4:55pm UTC](https://meta.discourse.org/t/nginx-error-502/199458 "2021-08-06T16:55:48Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Pro\_Dev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pro_dev/32/230063_2.png) [@Pro\_Dev](https://meta.discourse.org/u/Pro_Dev)
#### Post date: [August 6, 2021, 4:55pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/1 "2021-08-06T16:55:48Z")

</div>

Hi,

Second question of the day. I feel very dumb xD  
Well then, I get 502 Bad gateway. I don’t know nginx that well.  
I have followed [This guide](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247)

Cheers!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 6, 2021, 5:20pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/3 "2021-08-06T17:20:29Z")

</div>

> [@Pro\_Dev](#):
>
> I have followed [This guide](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247)

> [@Pro\_Dev](#):
>
> I don’t know nginx that well.

As that guide says

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247/1):
>
> NOTE: This is for advanced admins

If you aren’t familiar with nginx, docker and web hosting in general, please stay on the official guide.

---

<div class="post-metadata">

### Author: ![Pro\_Dev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pro_dev/32/230063_2.png) [@Pro\_Dev](https://meta.discourse.org/u/Pro_Dev)
#### Post date: [August 6, 2021, 5:25pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/4 "2021-08-06T17:25:14Z")

</div>

Well i do know a bit of nginx, and I use it regularly. But I don’t know the errors of nginx well. I don’t really see any obvious errors.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [August 6, 2021, 5:44pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/5 "2021-08-06T17:44:30Z")

</div>

502 means your Discourse instance is not starting / started / running.

---

<div class="post-metadata">

### Author: ![Pro\_Dev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pro_dev/32/230063_2.png) [@Pro\_Dev](https://meta.discourse.org/u/Pro_Dev)
#### Post date: [August 6, 2021, 5:52pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/6 "2021-08-06T17:52:19Z")

</div>

Hi, After some investigation i found the `nginx.http.sock` file never gets created

Not when rebuilding, or whatever.

How can i fix this?

With kind regards,  
ProDev

---

<div class="post-metadata">

### Author: ![Pro\_Dev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pro_dev/32/230063_2.png) [@Pro\_Dev](https://meta.discourse.org/u/Pro_Dev)
#### Post date: [August 6, 2021, 6:53pm UTC](https://meta.discourse.org/t/nginx-error-502/199458/7 "2021-08-06T18:53:25Z")

</div>

After even more investigation i now found the issues (I think) now I get this:

```plaintext
Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/nginx/conf.d/discourse.conf
Location of failure: /pups/lib/pups/replace_command.rb:8:in `read'
replace failed with the params {"filename"=>"/etc/nginx/conf.d/discourse.conf", "from"=>"/listen 80;/", "to"=>"listen unix:/shared/nginx.http.sock;\nset_real_ip_from unix:;\n"}
29a62052d71af43fee746d9257942f63ef14ff9262465631dee891769

```

---

<div class="post-metadata">

### Author: ![Serakoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/serakoi/32/213093_2.png) [@Serakoi](https://meta.discourse.org/u/Serakoi)
#### Post date: [August 7, 2021, 10:37am UTC](https://meta.discourse.org/t/nginx-error-502/199458/8 "2021-08-07T10:37:31Z")

</div>

Any ideas @Falco ? Because we really do not know.
