将 Discourse 服務從子文件夾(路徑前綴)提供,而非子域名

抱歉,我指的是类似这样的设置:

容器配置 web_only.yml

templates:
# [...]
  - "templates/web.socketed.template.yml"
# [...]
#expose:
#  - "80:80"   # http
#  - "443:443" # https

外部 nginx-site.conf

server {
    listen 443 ssl default_server;
# [...]
    location ~ ^/forum {
        proxy_pass http://unix:/path-to-discourse/discourse/shared/web-only/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;
        proxy_set_header Accept-Encoding $http_accept_encoding;
    }
# [...]
}
2 个赞