I'm running a nginx reverse proxy container which has two subdomains. I can't reach either of the pages because it always returns "the site can't be reached"
.
The proxy is on localhost
and I added the subdomains to /etc/hosts
.
When I try my configuration on nginx (installed on pc) everything works fine, but in the docker I get the refused connection. Another thing is when I try to check the logs they are empty, so I don't know where the problem lies.
This is my Dockerfile
:
FROM nginx
COPY default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
This is my default.conf
file:
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
proxy_pass http://10.10.1.54/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /rtsp-over-websocket {
proxy_pass http://10.10.1.54;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
error_log /var/log/nginx/debug.log debug;
}
server {
listen 80;
server_name camera2.localhost;
location / {
proxy_pass http://10.10.1.53/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /rtsp-over-websocket {
proxy_pass http://10.10.1.53;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
error_log /var/log/nginx/debug2.log debug;
}
I also docker exec into the container and I can see that the default.conf
is copied over, but again when I try to check the logs they are just empty.