Errore Gateway 502 su Nginx?

RISOLTO: disabilitazione del server nginx, esecuzione di discourse-setup, riabilitazione del server nginx e ricostruzione dell’app.

Ciao. Sto cercando di installare Discourse seguendo questa guida.

Questo è il mio file app.yml modificato (copiato dalle cartelle di Discourse e modificato seguendo le guide):

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## Scommenta queste due righe se desideri aggiungere Lets Encrypt (https)
#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"

## quali porte TCP/IP dovrebbe esporre questo contenitore?
## Se desideri che Discourse condivida una porta con un altro server web come Apache o nginx,
## vedi https://meta.discourse.org/t/17247 per i dettagli
expose:
#  - "80:80"   # http
#  - "2222:22"
#  - "443:443" # https

Questo è il blocco nginx del mio file discourse.conf:
server {

server_name forum.myhost;  #
listen [::]:443 ssl http2 ipv6only=on; # gestito da Certbot
listen 443 ssl http2; # gestito da Certbot
ssl_certificate /etc/letsencrypt/live/forum.myhost/fullchain.pem; # gestito da Certbot
ssl_certificate_key /etc/letsencrypt/live/forum.myhost/privkey.pem; # gestito da Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # gestito da Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # gestito da Certbot
ssl on;
http2_idle_timeout 5m; # aumentato dal valore predefinito di 3m;

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;
}
}
server {
if ($host = forum.myhost) {
    return 301 https://$host$request_uri;
} # gestito da Certbot

server_name www.forum.myhost;
return 301 $scheme://forum.myhost$request_uri;

    listen 80;
    listen [::]:80;

    server_name forum.myhost;
return 404; # gestito da Certbot
}

Il server funziona con SSL (Certbot installato) e reindirizza HTTP a HTTPS nel dominio principale, ma il dominio del forum restituisce un errore 502 Gateway. Sto utilizzando Cloudflare (senza opzioni di prestazioni o sicurezza abilitate).

Qualsiasi tipo di aiuto sarà molto apprezzato. Non riesco ad eseguire discourse-setup perché mostra: “Google: "apri le porte del TUO SERVIZIO CLOUD" per informazioni sulla risoluzione di questo problema.”

Ho controllato anche il firewall.

AGGIORNAMENTO: Forse un problema con questa riga? (Non vedo questo file nella cartella)
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;

1 Mi Piace

Why are you using nginx as a proxy?

Are there other websites on this server?

2 Mi Piace

Yep Stephen, I’m using nginx and have plans to upload a Drupal site. Default domain is working with SSL as I commented, and forum subdomain shows 502 gateway error.

OK, I stopped nginx in my server and discourse-setup works but I now see this error message:

Enabling Let’s Encrypt
web.ssl.template.yml NOT ENABLED–was it on already?
letsencrypt.ssl.template.yml NOT ENABLED – was it on already?

Unfortunately, there was an error changing

-d This may happen if you have made unexpected changes.

I really don’t know if I need to use let’s encrypt from Discourse or outside if I have it installed in my server.

Thanks for reading.

LAST EDIT: I just start server nginx and primary and secondary domains are working (keeping server let’s encrypt from Certbot in Discourse instance)

2 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.