Forwarding port 80 to 8080 using NGINX [closed]
As simple as like this,
make sure to change example.com to your domain (or IP), and 8080 to your Node.js application port:
server { listen 80; server_name example.com; location / { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass "http://127.0.0.1:8080"; }}
Source: https://eladnava.com/binding-nodejs-port-80-using-nginx/
NGINX supports WebSockets by allowing a tunnel to be setup between a client and a backend server. In order for NGINX to send the Upgrade request from the client to the backend server, Upgrade and Connection headers must be set explicitly. For example:
# WebSocket proxyingmap $http_upgrade $connection_upgrade { default upgrade; '' close;}server { listen 80; # The host name to respond to server_name cdn.domain.com; location / { # Backend nodejs server proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; }}