A
A
Alexander Gamov2018-07-30 17:35:46
Nginx
Alexander Gamov, 2018-07-30 17:35:46

Why does nginx not see the server_name variable after forwarding 80 and 443 ports?

There are two physical servers networked with a microtic, with a white IP looking into the Internet.
On the first server, a virtual machine with a website was spinning and everything was ok, but then it was necessary to raise a virtual machine with a website on the second server, and then problems began.
The sysadmin on Mikrotik divided the traffic from the new domain and sent it to the second server, but the domain was not visible from the php side ($_SERVER['HTTP_HOST']), we figured it out. Now it is impossible to catch it (domain) on nginx.
The problem is that the system administrator does not understand the web and these nginx of yours, and I only know him at the user level and we stupidly cannot understand each other. Tell me at least in which direction to dig.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Reversaidx, 2018-07-30
@slowdream

It's easier to do it differently, direct all traffic to Nginx (one of the servers), then procurate by domain name to another Nginx
server {
listen 80 443;
server_name proxy_domain;
location / {
access_log off;
proxy_pass IP
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\
}
}
And, accordingly, another config for another domain, because with the current redirect it is not clear what exactly reaches the server, and in my case everything will start for 5 minutes (you can not use the third virtual machine, but proxy from the working server to a new server specifically for the domain)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question