¿Error 502 Gateway en Nginx?

RESUELTO: deshabilitando el servidor nginx, ejecutando discourse-setup, habilitando el servidor nginx y reconstruyendo la aplicación.

Hola. Estoy intentando instalar Discourse siguiendo esta guía.

Este es mi archivo app.yml editado (copiado de las carpetas de discourse y editado siguiendo las guías):

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## Descomenta estas dos líneas si deseas agregar Lets Encrypt (https)
#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"

## ¿Qué puertos TCP/IP debe exponer este contenedor?
## Si deseas que Discourse comparta un puerto con otro servidor web como Apache o nginx,
## consulta https://meta.discourse.org/t/17247 para más detalles
expose:
#  - "80:80"   # http
#  - "2222:22"
#  - "443:443" # https

Este es mi bloque nginx de discourse.conf:
server {

server_name forum.myhost;  #
listen [::]:443 ssl http2 ipv6only=on; # gestionado por Certbot
listen 443 ssl http2; # gestionado por Certbot
ssl_certificate /etc/letsencrypt/live/forum.myhost/fullchain.pem; # gestionado por Certbot
ssl_certificate_key /etc/letsencrypt/live/forum.myhost/privkey.pem; # gestionado por Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # gestionado por Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # gestionado por Certbot
ssl on;
http2_idle_timeout 5m; # aumentado desde el valor predeterminado de 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;
} # gestionado por Certbot

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

    listen 80;
    listen [::]:80;

    server_name forum.myhost;
return 404; # gestionado por Certbot
}

El servidor está funcionando con SSL (Certbot instalado) y redirige http a https en el dominio principal, pero el dominio del foro muestra un error 502 Gateway. Estoy usando Cloudflare (sin opciones de rendimiento o seguridad habilitadas).

Cualquier tipo de ayuda será muy apreciada. No puedo ejecutar discourse-setup porque muestra “Google: "abrir puertos TU SERVICIO EN LA NUBE" para obtener información sobre cómo resolver este problema”.

También verifiqué el firewall.

EDIT: ¿Quizás un problema con esta línea? (No veo este archivo en la carpeta)
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;

1 me gusta

Why are you using nginx as a proxy?

Are there other websites on this server?

2 Me gusta

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 Me gusta

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