Answer the question
In order to leave comments, you need to log in
How to proxy a subdomain to a site folder?
what needs to be written in the nginx config so that when target.site.ru is opened,
everything works the same as when normal.site.ru/target is opened?
now the config looks like
server {
listen 80;
listen [::]:80;
root /var/www/target.site.ru/html;
index index.php index.html;
server_name target.site.ru;
location / {
proxy_pass http://normal.site.ru/target;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
http://normal.site.ru/target;
Answer the question
In order to leave comments, you need to log in
Add "/" at the end:
server {
...
location / {
proxy_pass http://normal.site.ru/target/;
...
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question