Answer the question
In order to leave comments, you need to log in
nginx. How to make a site mirror through Proxy pass?
Good afternoon.
I comprehend Nginx) Please tell me how to make a site mirror through Proxy pass?
That is, when you go to the SITE1.COM site, SITE2.COM is loaded without changing the address. Ie not a redirect as a matter of fact.
Is it possible at all?
Tried like this:
server {
listen 9999;
server_name site1.com;
access_log /var/log/nginx/test/access.log;
error_log /var/log/nginx/test/error.log;
location / {
proxy_pass http://site2.com
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
Answer the question
In order to leave comments, you need to log in
location / {
resolver 8.8.8.8;
proxy_cache my_cache;
proxy_pass https://example.com;
proxy_redirect off;
proxy_intercept_errors on;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header Host example.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question