Hey guys,
I looked around but I couldn’t see a guide on how to host Discourse on domain.com/forum with SSL, using nginx as a reverse proxy. Currently, I’m running the forum on a subdomain - forum.domain.com and What I have in mind is, I’ll use nginx to secure the connection between the user and my server, and then call discourse locally unsecured via reverse proxy since they’re on the same machine, as per the latest set up tutorial.
I already have Ghost running the same way, and it works flawlessly.
This is my old location statement for the reverse proxy for forum.domain.com and it worked, though not securely.
# 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 $scheme;
# }
}
When I set this same proxy pass on location /forum in the main server block, I’m getting 404 errors for all assets, even though they’re being loaded via /forum/
location /forum {
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 $scheme;
}
The error console shows these assets are missing:
Strangely enough, the 404 pages almost work consistently, but are still missing image assets:
What I also notice is that when I do discourse remap domain.com/ domain.com/forum
, there’s an error remapping theme_fields
Is there a way I can check these rows specifically and see what the problem is?
The easiest solution would be a wildcard certificate but that’s beyond my budget range at this point.
Any help would be appreciated and I do apologise if this issue was already resolved elsewhere, I just couldn’t find this specific scenario.
Update: Here’s the env variables in app.yml
env:
LANG: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 8
## TODO: The domain name this Discourse instance will respond to
DISCOURSE_HOSTNAME: legiochristi.com
DISCOURSE_RELATIVE_URL_ROOT: /forum
## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
DOCKER_USE_HOSTNAME: true