Skip to content

Instantly share code, notes, and snippets.

@mplatts

mplatts/example.com.conf

Last active Oct 6, 2015
Embed
What would you like to do?
Meteor nginx
server {
# Internet traffic will come in on port 80
listen 80;
# Apply only to traffic heading to example.com
# NOTE: change to your domain name
server_name example.come;
# When things are going wrong we can check the logs
access_log /var/log/nginx/app.dev.access.log;
error_log /var/log/nginx/app.dev.error.log;
# Our static assets should have no expiry date - so when user leaves site and comes back it will be in cache
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
root /path/to/your/app/bundle/programs/web.browser; # NOTE: change the path to your path here
access_log off; # Don't log to access log
expires max; # Set max expiry date for these assets so browser won't expire them from cache
}
# For when user goes to some path that isn't an asset eg "/something/something"
location / {
proxy_pass http://127.0.0.1:3000; # pass this request to your app (or change 3000 to whatever port your app is on)
# This stuff is to support websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; #
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.