Created
October 16, 2018 10:30
-
-
Save puttpotsawee/7793153f977d28230a123412bffe23b0 to your computer and use it in GitHub Desktop.
Nginx Reverse proxy to another server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream node { | |
# THIS IS THE IP ADDRESS TO PROXY TO | |
server 35.222.33.12:80 max_fails=2 fail_timeout=2s; | |
} | |
server { | |
listen 80; | |
server_name _; | |
root /usr/share/nginx/html; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
# CHANGE ME | |
proxy_set_header Host $host; | |
proxy_pass http://node; | |
proxy_redirect off; | |
port_in_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment