I have 2 services running in my docker, /app1 and /app2. I setup my nginx reverse proxy for the services on port 80.
But for some reason, the Request URL is without the /app2/ part.
For example,
If I request http://localhost/app2/files, it just redirects to http://localhost/files and I see 404 in my logs.
Is it because the /files is a directory that contains my files?
BTW, when i request http://localhost/app2/files/photo.png, I get my file correctly. But the file is not requested properly in the nginx reverse proxy.
Please find my config below and suggest me how to fix it :)
PS: The server works perfectly when I run it on main port (not the nginx proxy).
My nginx.conf:
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
}
location /app1/ {
proxy_pass http://app1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /app2/ {
proxy_pass http://app2:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}