Skip to content

Instantly share code, notes, and snippets.

@yeonwooz
Created February 9, 2023 06:37
Show Gist options
  • Save yeonwooz/32b3249a93d4984fa3e328a58c7f9a84 to your computer and use it in GitHub Desktop.
Save yeonwooz/32b3249a93d4984fa3e328a58c7f9a84 to your computer and use it in GitHub Desktop.
nginx reverse proxy configuration for socket i.o
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8080/;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade; // 핸드셰이크 업그레이드
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr; # This line.
proxy_set_header Host $host;
proxy_http_version 1.1;
}
location /socket.io/ {
proxy_pass http://localhost:5002/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; // 핸드셰이크 업그레이드
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment