Answer the question
In order to leave comments, you need to log in
How to write correct rewrite?
There are several "wrong web pages" on the internal network that open correctly when "direct access" to the sites on which they are located. To access them from the outside, I use nginx with a location, inside which I do rewrite.
location example
location /esp1/ {
rewrite ^/esp1/(.*)$ /$1 break;
proxy_pass http://esp1;
}
_div class="c"_
_a href="configmain"_Main_/a _
_a href="configall"_Hardware_/a_
_a href="configsrv"_Servers_/a_
_hr_
_a href="/debug"_Debug_/a_
_a href=" /configrst"_Restart_/a_
_/div_
2018/02/06 16:59:27 [notice] 20908#20908: *1 "^/esp1(.*)$" matches "/esp1/configmain", client: 172.16.0.1, server: mediaserver, request: "GET /esp1/configmain HTTP/1.1", host: "192.168.1.16", referrer: "http://..................ru/esp1/"
2018/02/06 16:59:27 [notice] 20908#20908: *1 rewritten data: "/configmain", args: "", client: 172.16.0.1, server: mediaserver, request: "GET /esp1/configmain HTTP/1.1", host: "192.168.1.16", referrer: "http://..................ru/esp1/"
2018/02/06 16:59:35 [notice] 20908#20908: *1 "^/esp1(.*)$" matches "/esp1/", client: 172.16.0.1, server: mediaserver, request: "GET /esp1/ HTTP/1.1", host: "192.168.1.16"
2018/02/06 16:59:35 [notice] 20908#20908: *1 rewritten data: "/", args: "", client: 172.16.0.1, server: mediaserver, request: "GET /esp1/ HTTP/1.1", host: "192.168.1.16"
2018/02/06 16:59:37 [error] 20908#20908: *1 open() "/home/www/configrst" failed (2: No such file or directory), client: 172.16.0.1, server: mediaserver, request: "GET /configrst HTTP/1.1", host: "192.168.1.16", referrer: "http://..................ru/esp1/"
Answer the question
In order to leave comments, you need to log in
I read it several times and still did not understand your chaotic story.
But what you want is called proxying.
Let's look at the details with examples:
There is a test.com resource and it has an image at test.com/images/img.jpg
1. There is a test2.com resource where we would like to display this image at test2.com/images /img.jpg
In the test2.com server settings, write the following location:
location /images/ {
proxy_pass http://test.com;
}
location /pictures/ {
rewrite /pictures/(.+) /images/$1 break;
proxy_pass http://test.com;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question