Answer the question
In order to leave comments, you need to log in
Why does NGINX incorrectly determine the ip address of the server from the dns name?
There are two servers, nginx is installed on one server, plus the site les.lesok.ru is running on port 80. I want to redirect the request to another server to the second site dom.domik.ru, but for some reason, when requesting the second site, nginx determines the ip of the current server from it and, accordingly, gives incorrect data. The
config is like this
server
{
listen 80;
server_name dom.domik.ru;
location /
{
return 301 https://dom.domik.ru;
}
}
server
{
listen 443 ssl;
ssl_certificate /usr/local/nginx/conf/cert.pem;
ssl_certificate_key /usr/local/nginx/conf/cert.key;
server_name dom.domik.ru;
location /
{
proxy_pass http://10.*.*.50;
proxy_set_header Host 10.*.*.50;
}
}
Answer the question
In order to leave comments, you need to log in
The proxied server needs to send the Host
header if IP is used as the proxy address and the target site is not default on the proxied serverproxy_set_header Host "example.com";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question