NGINX Reverse-Proxy for LXC Containers

Viewed 1879

Basic scenario:

I have a (physical) server running Proxmox.

On this hardware I run LXC containers (let's call them 100, 101...), all with NGINX started.

My goal:

Configure container 100 in a way that it acts as a reverse proxy to all my other containers.

Current configuration:

  • on container 100 (the reverse proxy)

    server {
        listen 80 default_server;
        server_name _;
        location / {
                proxy_pass http://192.168.178.101:80;
        }
    }
    
  • on container 101, one of the targets

    # This is a default site configuration which will simply return 404, preventing
    # chance access to any other virtualhost.
    
    server {
    listen 80 default_server;
    
    # Everything is a 404
    location / {
            return 404;
    }
    
    # You may need this to prevent return 404 recursion.
    location = /404.html {
            internal;
    }
    }
    

Both containers get a static IP, 100 get's 192.168.178.100 and 101 get's 192.168.178.101.

I can access 101 by it's IP from my browser, however 100 is unreachable.

It's the first time I'm setting up a network like this, pls excuse any stupid mistake I did!

0 Answers
Related