I'm trying to deploy an app through docker containers and reverse proxy it to my destination endpoint.
My docker compose file looks like this:
version: '3.4'
services:
monitor.api:
image: ${DOCKER_REGISTRY-}monitorapi
ports:
- "5001:443"
build:
context: .
dockerfile: monitor.API/Dockerfile
webapp:
image: ${DOCKER_REGISTRY-}monitorwebapp
ports:
- "4205:443"
- "4206:80"
build:
context: ./monitor-webApp
args:
- BASE_API_URL=${BASE_API_URL}
dockerfile: Dockerfile
Both of the containers are getting built and running successfully. To access them I'm trying to set up a Nginx server with such config:
server {
listen 80;
server_name <HOST IP>;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location /monitorwebapp/ {
proxy_pass http://<HOST IP>:4206/;
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 /monitorapi/ {
proxy_pass https://<HOST IP>:5001/api/;
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;
}
}
So with that, my expectation, would be if I go to http://HOSTIP/monitorwebapp I should get my webapp. However, I'm only getting 404 and the only way for me to access it is through: http://HOSTIP:4206.
There is nothing in the error logs as well. Any ideas how I could fix this?
there is nothing in the error logs
- which logs? nginx? that would indicate that the 404 comes from the httpd inside the container. Check its logs as well.