Skip to content

Instantly share code, notes, and snippets.

@harshvardhanmalpani
Created December 9, 2020 15:46
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 harshvardhanmalpani/23e8ea48900c9cd131b594ebc300e0eb to your computer and use it in GitHub Desktop.
Save harshvardhanmalpani/23e8ea48900c9cd131b594ebc300e0eb to your computer and use it in GitHub Desktop.
nginx configuration for proxying web sockets
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server 127.0.0.1:4050;
}
server {
listen 172.31.83.59:443 ssl ;
server_name DOMAIN.com www.DOMAIN.com;
access_log /usr/local/apache/domlogs/DOMAIN.com.bytes bytes;
access_log /usr/local/apache/domlogs/DOMAIN.com.log combined;
error_log /usr/local/apache/domlogs/DOMAIN.com.error.log error;
ssl_certificate /etc/pki/tls/certs/DOMAIN.com.bundle;
ssl_certificate_key /etc/pki/tls/private/DOMAIN.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://127.0.0.1:4050;
include proxy.inc;
}
location ~ /\.ht {deny all;}
location ~ /\.svn/ {deny all;}
location ~ /\.git/ {deny all;}
location ~ /\.hg/ {deny all;}
location ~ /\.bzr/ {deny all;}
disable_symlinks if_not_owner from=/home/nodeapi/public_html;
location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment