خطأ 502 Gateway على Nginx؟

مُحَلَّ: تعطيل خادم nginx، وتشغيل discourse-setup، وإعادة تمكين خادم nginx وإعادة بناء التطبيق.

مرحبًا بك. أحاول تثبيت Discourse وفقًا لهذا الدليل.

هذا هو ملف app.yml المعدّل الخاص بي (نُسخ من مجلدات discourse وتم تعديله وفقًا للدلائل):

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## قم بإلغاء التعليق عن هذين السطرين إذا كنت ترغب في إضافة Lets Encrypt (https)
#  - "templates/web.ssl.template.yml"
#  - "templates/web.letsencrypt.ssl.template.yml"

## ما هي منافذ TCP/IP التي يجب أن يعرضها هذا الحاوية؟
## إذا كنت تريد أن يشارك Discourse منفذًا مع خادم ويب آخر مثل Apache أو nginx،
## راجع https://meta.discourse.org/t/17247 للحصول على التفاصيل
expose:
#  - "80:80"   # http
#  - "2222:22"
#  - "443:443" # https

هذا هو كتلة nginx في ملف discourse.conf:
server {

server_name forum.myhost;  #
listen [::]:443 ssl http2 ipv6only=on; # تم إدارتها بواسطة Certbot
listen 443 ssl http2; # تم إدارتها بواسطة Certbot
ssl_certificate /etc/letsencrypt/live/forum.myhost/fullchain.pem; # تم إدارتها بواسطة Certbot
ssl_certificate_key /etc/letsencrypt/live/forum.myhost/privkey.pem; # تم إدارتها بواسطة Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # تم إدارتها بواسطة Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # تم إدارتها بواسطة Certbot
ssl on;
http2_idle_timeout 5m; # تم رفعه من الافتراضي 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;
} # تم إدارتها بواسطة Certbot

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

    listen 80;
    listen [::]:80;

    server_name forum.myhost;
return 404; # تم إدارتها بواسطة Certbot
}

يعمل الخادم مع SSL (تم تثبيت Certbot) ويعيد توجيه http إلى https في النطاق الأساسي، لكن نطاق المنتدى يُظهر خطأ 502 Gateway. أنا أستخدم Cloudflare (بدون تفعيل خيارات الأداء أو الأمان).

أي نوع من المساعدة سيكون مُقدَّرًا جدًا. لا يمكنني تنفيذ discourse-setup لأنه يظهر: “Google: “open ports YOUR CLOUD SERVICE” للحصول على معلومات لحل هذه المشكلة.”

تم التحقق من جدار الحماية أيضًا.

تعديل: ربما تكون هناك مشكلة في هذا السطر؟ (لا أرى هذا الملف في المجلد)
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;

إعجاب واحد (1)

Why are you using nginx as a proxy?

Are there other websites on this server?

إعجابَين (2)

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)

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