Skip to content

Instantly share code, notes, and snippets.

@zew13
Created January 15, 2022 14:29
Show Gist options
  • Select an option

  • Save zew13/c1b2b6e3b0cfd0d614b23d9146efed86 to your computer and use it in GitHub Desktop.

Select an option

Save zew13/c1b2b6e3b0cfd0d614b23d9146efed86 to your computer and use it in GitHub Desktop.
worker_processes ${CPU_N};
events {
}
http {
server_tokens off;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_vary on;
gzip_proxied any;
brotli on;
brotli_comp_level 6;
brotli_buffers 16 8k;
brotli_min_length 20;
brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
map $uri $url {
~/(.*) $1;
}
map $uri $wsGroup {
~/([^:]+) $1;
}
server {
listen ${NCHAN.PORT.SUB};
location /ws: {
proxy_pass http://${API.INTRANET}:${API.PORT};
}
location / {
nchan_subscriber;
nchan_deflate_message_for_websocket on;
nchan_channel_group ${NAME};
nchan_channel_id $url $wsGroup;
nchan_authorize_request /ws:$url;
}
}
server {
listen ${NCHAN.PORT.PUB};
location / {
nchan_publisher;
nchan_channel_group ${NAME};
nchan_channel_id $url;
nchan_message_buffer_length 1;
nchan_message_timeout 1s;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment