Skip to content

Instantly share code, notes, and snippets.

@lechidung
Created November 3, 2019 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lechidung/30b5d84a2fe2f1bf171acc201f0e3389 to your computer and use it in GitHub Desktop.
Save lechidung/30b5d84a2fe2f1bf171acc201f0e3389 to your computer and use it in GitHub Desktop.
configure NGINX to reverse proxy connections from port 80 to other port
server {
listen 80;
server_name hoge.hoge.com; # or server_name subdomain.yourapp.com;
location / {
proxy_pass http://localhost:1337; # port > 1024
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;
# Enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment