I'm trying to setup multiple docker
containers with the same image on a single machine and hosting all the application on the same domain separated by path. The purpose is to isolate each customers into it's own container. i.e. mydomain.com/aaa
, mydomain.com/bbb
... etc.
I'm using nginx
as the reverse proxy and followed various example online. My nginx configuration looks like:
server {
listen ...;
...
location / {
proxy_pass http://127.0.0.1:8080;
}
location /aaa {
proxy_pass http://127.0.0.1:8181;
}
location /bbb {
proxy_pass http://127.0.0.1:8282;
}
...
}
I noticed that the application is expecting to be hosted on the root /
which currently end up in 404. Is there a clever way to rewrite those into it's own path based on the origin of the request without modifying the application itself?
I'm aware that it might be easier to use sub-domain but I want to avoid adding and removing sub-domain as customers come and go.