I am very new to nginx configuration. I want to use it set virtual hosts so that I can run different Node JS apps on different ports on the same server, but have them served at different subdomains. After some searching I found a post on stackoverflow and it works well for what I want to do. Amongst other things, the code involved the following location block
location / { │
proxy_set_header X-Real-IP $remote_addr; │
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; │
proxy_set_header Host $http_host; │
proxy_set_header X-NginX-Proxy true; │
│
proxy_pass http://otherapp/; │
proxy_redirect off; │
}
Now I wanted to understand what the script does. I looked at nginx docs and notes posted by various people, and understood a few things. It appears to me that what I want will probably work even if I remove all the proxy_set_header
lines in the above code EXCEPT proxy_pass
. I want to learn what the different fields in the above code are doing. Probably they are useful for some things that I don't realize at the moment. Is there a place which lists all the fields for proxy_set_header
module and explains them?
Thank you.