Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
Reverse Proxy Nginx with Subdomain
« previous
next »
Print
Pages: [
1
]
Author
Topic: Reverse Proxy Nginx with Subdomain (Read 1023 times)
maraD
Newbie
Posts: 10
Karma: 0
Reverse Proxy Nginx with Subdomain
«
on:
March 24, 2024, 08:24:39 pm »
Hello dear Community,
I need your help with the topic of Reverse Proxy Nginx! 😄
Here's the task I need to tackle:
I receive the following client requests:
https://x1.domain.io/zs/ef/x/
<--- The request comes in this format.
What needs to be done: The subdomain determines which website will be opened.
For all requests, the index.htm must always be accessible at domain.io/zs/ef/x/zs/ef/x/.
Only one server is defined as the upstream server. It has the corresponding index.htm and associated files in /var/www/x1.
This means:
Request A:
https://x1.domain.io/zs/ef/x/
Retrieves data from the WebRoot: /var/www/x1/
Request B:
https://x2.domain.io/zs/ef/x/
Retrieves data from the WebRoot: /var/www/x2/
I've set up the default configuration in Nginx, it's running, and the page is being displayed. 😄
The location is "/", so when
https://x1.domain.io/zs/ef/x/
is accessed, the page is displayed as desired. MEGA!
A domain is set up, and the subdomain names are entered as alternative names in the certificate. 😉
The logic above doesn't work as intended. Since the path in the webroot is decisive and not the subdomain, this needs to be reversed.
Thanks for any input!
Logged
Fright
Hero Member
Posts: 1777
Karma: 164
Re: Reverse Proxy Nginx with Subdomain
«
Reply #1 on:
March 30, 2024, 04:17:54 pm »
Hi
I’m not sure that I fully understand, but if you want to do this through GUI, you will have to make two servers:
x1.domain.io
x2.domain.io
(upstream may be left alone)
To add a folder to URL, you can add two rewrite rules like:
rewrite ^(/zs/ef/x/)(.*) $1x1/$2 last;
rewrite ^(/zs/ef/x/)(.*) $1x2/$2 last;
and add them to the appropriate servers.
but I'm really not sure I understood the intent correctly
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Web Proxy Filtering and Caching
(Moderator:
fabian
) »
Reverse Proxy Nginx with Subdomain