Nginx proxy port 80 problem

nedgates

New Member
Oct 13, 2020
2
0
1
34
Hello everyvone,

So currently running a dedicated with one IP but need multiple containers that can serve port 80 each with their own internal/private IP. I have followed this guide the T but having issues with apt-get in the CT with port 80. Possibly because of the proxy? Network in the CTs were working fine but after I added the Nginx proxy everything broke. SSH into the CT from outside works as well.

Host IPTables
Code:
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       tcp  --  anywhere             anywhere             tcp dpt:10022 to:192.168.1.100:22
DNAT       tcp  --  anywhere             anywhere             tcp dpt:10122 to:192.168.1.101:22
DNAT       tcp  --  anywhere             anywhere             tcp dpt:http to:192.168.1.100:80

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  192.168.1.0/24       anywhere

Host interface
Code:
auto lo
iface lo inet loopback

iface eno1 inet manual

auto vmbr0
iface vmbr0 inet static
    address xx.xxx.xxx.95
    netmask 255.255.255.0
    gateway xx.xxx.xxx.1
    bridge_ports eno1
    bridge_stp off
    bridge_fd 0

auto vmbr0:0
iface vmbr0:0 inet static
   pre-up iptables-restore < /etc/iptables.rules
   address 192.168.1.1
   netmask 255.255.255.0
   network 192.168.1.0
   broadcast 192.168.1.255

Nginx Proxy CT interfaces file (CT 100)
Code:
auto eth0
iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1

Nginx Proxy CT nginx config file 192.168.0.1 routerlogin 192.168.10.1
Code:
server {
  listen 80;
  server_name domain.com *.domain.com;

  location / {
    proxy_pass              http://192.168.1.101;
    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_connect_timeout   150;
    proxy_send_timeout      100;
    proxy_read_timeout      100;
    proxy_buffers           4 32k;
    client_max_body_size    8m;
    client_body_buffer_size 128k;
  }
}

Nginx Webserver CT (CT 101)
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.1.101
        netmask 255.255.255.0
        gateway 192.168.1.1

I am looking forward to your help regarding this problem.

Best regards.

Edit: I solved the problem using separate bridge, thanks.

https://pve.proxmox.com/pve-docs/pv..._nat_with_span_class_monospaced_iptables_span
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!