Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Nging site configuration for Meteor applications, as shown at
server_tokens off; # for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
server {
listen 8080;
listen 443 ssl;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_certificate /home/ubuntu/certs/crt;
ssl_certificate_key /home/ubuntu/certs/key;
if ($http_user_agent ~ "MSIE" ) {
return 303;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# no cache
expires -1;
# cache static
# this setting allows the browser to cache the application in a way compatible with Meteor
# on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
# the root path (/) MUST NOT be cached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment