Answer the question
In order to leave comments, you need to log in
How to redirect multiple locations to different servers?
There is 1 computer with one port to which there is an access from the outside (VPN the client).
This computer is connected to a local network, where there are several computers with their own, rather complex (more than one page), sites (ip and ports are different).
There is a desire to use nginx to watch these sites from the outside. Something like this
http://единственный_ip/one
http://единственный_ip/two
...
location /one {
proxy_pass http://ipone:portone;
proxy_set_header X-Real-IP $remote_addr;
}
location /two {
proxy_pass http://iptwo:porttwo;
proxy_set_header X-Real-IP $remote_addr;
}
...
http://ipone:portone/one
http://iptwo:porttwo/two
Answer the question
In order to leave comments, you need to log in
Everything is as easy as shelling pears and even more so already described in the documentation
https://nginx.ru/ru/docs/http/ngx_http_proxy_modul...
location /one/ {
rewrite ^/one/$ /$1 break;
proxy_pass http://ipone:portone;
proxy_set_header X-Real-IP $remote_addr;
}
location /two/ {
rewrite ^/two./$ /$1 break;
proxy_pass http://iptwo:porttwo;
proxy_set_header X-Real-IP $remote_addr;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question