Last active
October 6, 2015 01:51
-
-
Save mplatts/0313ca6e716aba0f93ba to your computer and use it in GitHub Desktop.
Meteor nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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