ProxyPass domain to subdirectory
April 15, 2021 11:27AM

Currently I have a website sitting at "" which I would like to proxy pass to another host like "" reason for this is I have multiple sites on separate systems and want to keep them all appended this way.

My problem however is when loading "" it spins as it's trying to load other directories which are loading from without the appended /site1/.

I realize Nginx only proxies specific requests yet is there a way to have this work and proxy everything from "" to include subdirectories and files to "".

My config is...

location /site1/ {
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_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;

I've tried using "rewrite /site1/([^/]+) /$1 break;" after location but nothing seems to be working.

Ideally I've done this by adding each location its specifying and then using a rewrite but I'd rather have it all in 1 rule as I have multiple other sites I plan to add to this.

Any help would be appreciated!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 45
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready