Welcome! Log In Create A New Profile

Advanced

nginx reverse proxy

March 31, 2021 10:19AM
I'm newbie to nginx

I have an apache server in lxc
192.168.1.10 (3x vhost/domain)

Each vhost is configured as follows and works perfectly

----------
<VirtualHost *:80>
DocumentRoot /var/www/www.domain1.ddns.com
ServerName domain1.ddns.com
ServerAlias www.domain1.ddns.com
ServerAdmin webmaster@domain1.ddns.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1\.ddns\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain1.ddns.com$1 [R=301,NE,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
</VirtualHost>

<VirtualHost *:443>
DocumentRoot /var/www/www.domain1.ddns.com
ServerName domain1.ddns.com
ServerAlias www.domain1.ddns.com
ServerAdmin webmaster@domain1.ddns.com
<IfModule mod_ssl.c>
SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/domain1.ddns.com/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/domain1.ddns.com/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/domain1.ddns.com/chain.pem
# SSLCertificateChainFile /etc/letsencrypt/live/domain1.ddns.com/fullchain.pem
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1\.ddns\.com$ [NC]
RewriteRule ^(.*)$ https://www.domain1.ddns.com$1 [R=301,NE,L]
</VirtualHost>
-----------

All my domains are visible from the internet because I have forward ports 80/443 on IP 192.168.1.10

Now I will build another apache server in lxc
192.168.1.11 (3x vhost/domain)
For vhosts I want to use a similar configuration as on the first apache.
I don't want to change the configuration of apache vhosts.
Because it is not possible to make forward ports to 2 local IP addresses, I need to build a reverse proxy.

Today I installed nginx in lxc
192.168.1.12
How should I configure nginx?
Subject Author Posted

nginx reverse proxy

gusto1 March 31, 2021 10:19AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 256
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready