P
P
Pista2019-11-12 19:49:27
Nginx
Pista, 2019-11-12 19:49:27

How to properly proxy Nginx requests to OpenServer?

I redirect requests from the VPS to the OpenServer home server
For example, on the VPS I have the vpssite.ru domain with the config

server {
    listen 80;
    server_name vpssite.ru;


location / {
    proxy_pass http://openserversite.ru;
#  proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    }
}

I redirect requests from the Vpssite.ru domain to openserversite.ru. I noticed that if you do not comment out the line proxy_set_header Host $host; then when accessing, the OpenServer stub pops up "Oops?! ;-)
How did you get here?
To redirect IP to the desired domain, create an alias in the settings."
What proxy_set_header is used for Host $host; ? is it possible to do without this line?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question