تم العثور على المشكلة التي تمنع منفذًا في /var/discourse/containers/web_only.yml كما يلي:
exposé:
# - "443:443"
# - "80:80"
- "8080:80" # https
وفقًا لـ Solve Nginx 13: Permission denied) while connecting to upstream - Programmer All ، كان SELinux هو السبب ويتطلب السماح لـ NGINX بالوصول إلى Discourse عن طريق التشغيل أو تعيين SELinux إلى وضع Permissive.
setsebool -P httpd_can_network_connect 1
الآن، الشيء المثير للاهتمام هو أنه إذا تم تعيين تكوين NGINX إلى المسار الجذر، فإنه يعمل بشكل جيد، ولكن ليس عندما يتم تعيينه إلى مسار غير جذري.
تم تعيين NGINX لإعادة توجيه / إلى Discourse (يعمل)
# Proxy requests to 443/discussions to Discourse listening on 127.0.0.1:8080
location / {
proxy_pass http://127.0.0.1:8080;
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 $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
تم تعيين NGINX لإعادة توجيه /discussions/ إلى Discourse (لا يعمل)
# Proxy requests to 443/discussions to Discourse listening on 127.0.0.1:8080
location /discussions/ {
proxy_pass http://127.0.0.1:8080;
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 $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
في هذه الحالة، أرى ما يلي … حدسي هو أنه على الرغم من أن NGINX قد أعاد توجيه المسار غير الجذري /discussions/ بنجاح إلى حاوية Docker الخاصة بـ Discourse، فإن Discourse نفسه لا يزال يقوم بتحميل الصفحات من نفسه ويتوقع أن تكون الأصول في المسار الجذري /. هل هو شرط لتشغيل Discourse في المسار الجذري فقط؟ @pfaffman هل رأيت هذا من قبل؟
/var/log/nginx/example.com.error.log
2022/10/01 09:33:23 [error] 1954781#1954781: *1 open() "/etc/nginx/html/images/discourse-logo-sketch.png" failed (2: No such file or directory), client: 219.78.157.149, server: uat.example.com, request: "GET /images/discourse-logo-sketch.png HTTP/1.1", host: "uat.example.com", referrer: "https://uat.example.com/discussions/"
2022/10/01 09:33:25 [error] 1954781#1954781: *1 open() "/etc/nginx/html/service-worker.js" failed (2: No such file or directory), client: 219.78.157.149, server: uat.example.com, request: "GET /service-worker.js HTTP/1.1", host: "uat.example.com", referrer: "https://uat.example.com/service-worker.js"