SHARE
TWEET

Nginx WebSocket Proxy

a guest May 25th, 2018 145 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. http {
  2.  
  3.     server {
  4.    
  5.         listen 443;
  6.    
  7.         ssl_certificate           /etc/nginx/ssl/cert.pem;
  8.         ssl_certificate_key       /etc/nginx/ssl/cert.key;
  9.    
  10.         ssl on;
  11.         ssl_session_cache  builtin:1000  shared:SSL:10m;
  12.         ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
  13.         ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
  14.         ssl_prefer_server_ciphers on;
  15.    
  16.         proxy_redirect          off;
  17.         proxy_set_header        Host            $host;
  18.  
  19.         location ~/wss/([a-zA-Z0-9\-\&\=\?\/\.]+) {
  20.    
  21.             #recommend to use the local DNS server address to avoid errors 502 or 504
  22.             resolver 8.8.8.8;
  23.    
  24.             proxy_pass https://$1;
  25.    
  26.             proxy_http_version 1.1;
  27.             proxy_set_header Upgrade $http_upgrade;
  28.             proxy_set_header Connection "upgrade";
  29.  
  30.         }
  31.  
  32.     }
  33.  
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top