Skip to content

Instantly share code, notes, and snippets.

@ryanstout
Created June 15, 2015 22:14
Show Gist options
  • Save ryanstout/57a1ad76ffddd7247434 to your computer and use it in GitHub Desktop.
Save ryanstout/57a1ad76ffddd7247434 to your computer and use it in GitHub Desktop.
daemon off;
events {
worker_connections 4096; ## Default: 1024
}
http {
include mime.types;
# serve static files when asked to
sendfile on;
# gzip compress when available
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/html text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
# server unix:/path/to/.unicorn.sock fail_timeout=0;
# for TCP setups, point these to your backend servers
server localhost:3000 fail_timeout=0;
# server 192.168.0.8:8080 fail_timeout=0;
# server 192.168.0.9:8080 fail_timeout=0;
}
server {
listen 3001;
root /Users/ryanstout/Sites/volt/apps/demos/blog_demo6/public;
server_name localhost;
# ~2 seconds is often enough for most folks to parse HTML/CSS and
# retrieve needed images/icons/frames, connections are cheap in
# nginx so increasing this is generally safe...
keepalive_timeout 10;
try_files $uri/index.html $uri.html $uri @app_server;
error_log logs/nginx-error.log warn;
access_log logs/nginx-access.log;
location @app_server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://app_server;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment