Setup Nginx Reverse Proxy for Docker app on Domain Subfolder
I’ve been struggling to get my Nginx Reverse Proxy to work for a Docker app. Similar questions have been asked but haven’t provided the solution for this situation. I’ve spent hours now trying to get this working.
I’m trying to self host Plausible which runs in a Docker container at http://localhost:8000
Going to http://server-ip:8000/ works fine
I want to set up a Nginx reverse proxy to provide SSL + and set it up on my domain. The tricky part is that I want to serve it from a subfolder instead of the root.
So serving it from https://app.mydomain.com/plausible instead of https://app.mydomain.com/
app.mydomain.com/plausible/ redirects to app.mydomain.com/login instead of app.mydomain.com/plausible/login.
If I manually go to app.mydomain.com/plausible/login I can see the form field but all the styling and scripts are broken. They try to load from app.mydomain.com/stylesheet.css instead of app.mydomain.com/plausible/stylesheet.css
So I believe the Docker app expects to be on the root URL. So Nginx should rewrite the requests to include the subfolder in some way? I just can’t figure out how to do it.
What I’ve tried:
Trailing slash, no trailing slash
All kinds of rewrite variations
Anyone who can help me in the right direction? Thank you in advance