Answer the question
In order to leave comments, you need to log in
How to set up Nginx as a proxy?
I've been trying to set it up all day and half the night, I already have no strength (
You need xxx.com/adb to be displayed as yyy.com (with the replacement of all links from xxx.com/adb to yyy.com)
Here is a piece of code:
server {
listen 80;
server_name xxx.com;
root /var/www/yyy.com/web;
location /adb/ {
resolver 8.8.8.8;
proxy_pass http://yyy.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
server {
listen 80;
server_name xxx.com;
root /var/www/yyy.com/web;
location /adb/ {
resolver 127.0.0.1;
rewrite ^/adb/(.*)$ /$1 break;
proxy_pass http://yyy.com;
proxy_redirect default; #???
proxy_set_header Host yyy.com;
}
}
location ~ ^/adb/logo\.png$ {
empty_gif;
}
server {
listen 80;
server_name yyy.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://xxx.com/adb/;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question