How to edit nginx/discourse.conf
I assume any changes to discourse.conf
inside the container get reverted by doing a rebuild anyway.
To keep changes you must some-how add them to your container configuration - e.g. web_only.yml
:
# […]
## Remember, this is YAML syntax - you can only have one block with a name
run:
- exec: echo "Beginning of custom commands"
# […]
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: $proxy_add_x_forwarded_for
to: $http_x_real_ip
global: true
# […]
How to debug a sub-folder Discourse install
In a Discourse sub-folder install a call to Discourse goes like this:
example.org/forum
→ [External proxy for example.org]
→ /path-to-discourse/discourse/shared/web-only/nginx.http.sock
→ [Nginx in Discourse web-container]
So if there is an error, we must first locate it:
- External proxy
- Nginx in Discourse container
- Discourse itself
External proxy
- Call it in a browser and check result.
- Check error logs of external proxy.
Nginx in Discourse container
- SSH into your webserver.
- Directly connect to socket via
curl
. - Debug
curl
output and logs ofNginx in Discourse
Important: use http
url – and not https
.
curl -I --unix-socket /path-to-discourse/discourse/shared/web-only/nginx.http.sock http://www.example.org/forum/
If this works, try a real call like:
curl --unix-socket /path-to-discourse/discourse/shared/web-only/nginx.http.sock \
-H "user-agent: Chrome/88.0.4324.182" \
-H "Accept-Encoding: gzip" \
http://www.example.org/forum/t/test-thread/12345 --output test-encoded.html.gz