Turnkey and LXC reverseproxy with Nginx

lilp

Renowned Member
Feb 10, 2016
63
1
73
36
Hi, I install nextcloud with Turnkey LXC template.
But I use Nginx as Reverseproxy on another LXC.
My LXC Nextcloud is on 192.168.1.46 and my LXC Nginx on 192.168.1.38.
I have a free account on No-ip for dynamic dns for access like : XxX.Xxx.Xxx

When I go to my Nextcloud on LAN is OK, but when I try by dynamic DNS with “XXX.XXX/nextcloud” I redirected to LAN IP, and it’s inaccessible.
Here it's my nginx conf file :
Code:
upstream plex_backend {
    server 192.168.1.30:32400;
    keepalive 32;
    }


server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name Xxx.xxx.xxx;
    ssl_certificate /etc/letsencrypt/live/Xxx.xxx.xxx/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/Xxx.xxx.xxx/privkey.pem; # managed by Certbot
  
  location / {
    proxy_pass http://192.168.1.41;
    }
 
    location /nextcloud {
    proxy_pass http://192.168.1.46/nextcloud;
    }

}

 
server {
    if ($host = Xxx.xxx.xxx) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


   listen 80 default_server;
   listen [::]:80;
   server_name Xxx.xxx.xxx;
   proxy_buffering off;
   add_header X-Frame-Options SAMEORIGIN;
   add_header X-Content-Type-Options nosniff;
   add_header X-XSS-Protection "1; mode=block";
   add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
   add_header Referrer-Policy strict-origin;
   real_ip_header X-Forwarded-For;
   rewrite ^(.*) https://Xxx.xxx.xxx$1 permanent;

  
   location / {
    rewrite ^(.*) https://Xxx.xxx.xxx$1 permanent;
    proxy_set_header X-Forwarded-Ssl on;
    }

   location /nextcloud {
    proxy_pass http://192.168.46/nextcloud;
    }


}
 

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!