I got a 502 Bad Gateway on my website and I can’t get pass this issue with nginx.http.sock
Nginx error.log
[crit] 14339#14339: *1 connect() to unix:/var/discourse/shared/standalone/nginx.http.sock failed (2: No such file or directory) while connecting to upstream, client: **.***.***.***, server: mydomain.net, request: "GET / HTTP/2.0", upstream: "http://unix:/var/discourse/shared/standalone/nginx.http.sock:/", host: "mydomain.net", referrer: "https:/mydomain.net/" "
Below my discourse.conf
server {
listen 80;
listen [::]:80;
server_name mydmain.net www.mydomain.net; # <-- change this
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mydomain www.mydomain.net; # <-- change this
ssl on;
ssl_certificate /etc/letsencrypt/live/mydomain.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.net/privkey.pem; # managed by Certbot
ssl_dhparam /etc/letsencrypt/live/mydomain.net/dhparams.pem;
include /etc/nginx/snippets/ssl.conf;
http2_idle_timeout 5m; # up from 3m default
location / {
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
}
}
My app.yml
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
- "templates/web.ssl.template.yml"
- "templates/web.letsencrypt.ssl.template.yml"
## - "templates/web.socketed.template.yml"
## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
#expose:
# - "2045:80" # http
# - "1443:443" # https
I tried to uncomment “templates/web.socketed.template.yml” as well but same result in the Nginx error log. What should I do to solve this problem? I ran out of idea. Please help ;/
SSL/Let’s Encrypt templates are commented because it’s already cared by your external Nginx config.
Rebuild the app so the nginx.http.sock file will appear in `/var/discourse/shared/standalone/
Okay, but what will happen about this line then? The 502 gateway error is gonne and the website is up, however I see the same nginx error because of this line.
OMGGG!!! Thannnnnkkk uuuuu <3 . I owe u a some fruits .N w I have to figure out how to make SMTP work cause with Yandex it didn’t work and I don’t receive any email when registering test users,