Forwarding DNS to LXC container

130 Views Asked by At

Eventhough I configured in my NGINX Proxy-Server to redirect to a LXC container when connected to a certain domain this is not working.

I am trying to connect to my website in a LXC container, I have pointed my domain towards it and in a additional LXC container (proxy) i have made a NGINX file that should redirect to that page.

When i remove the NGINX configuration I do get connected to proxy servers nginx once I browse to the site, when I use the NGINX config to redirect and browse to my site it can not connect.

I expected the NGINX Config to make it redirect to my page, this is my NGINX config in the proxy:

upstream containername {
    server containername .lxd:80;
}

server {
    listen 80 proxy_protocol;
    listen [::]:80 proxy_protocol;
    server_name domain.com;

    location / {
        proxy_pass https://containername;

        proxy_redirect off;
        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;
    }
}

When restarting NGINX on both the Proxy container and the site container I am not having any issues.

0

There are 0 best solutions below