Created
January 13, 2012 14:51
-
-
Save joequery/1606674 to your computer and use it in GitHub Desktop.
Nginx server configuration for use with Unicorn
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
worker_processes 1; | |
user nobody nogroup; | |
pid /tmp/nginx.pid; | |
error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; | |
accept_mutex off; | |
} | |
http { | |
default_type application/octet-stream; | |
access_log /tmp/nginx.access.log combined; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay off; | |
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 { | |
server unix:/tmp/.sock fail_timeout=0; | |
} | |
server { | |
client_max_body_size 4G; | |
server_name _; | |
keepalive_timeout 5; | |
############################################################################ | |
# Edit this path to point to the 'public' folder of your rails app | |
# This feels a little counter intuitive because this root path is NOT the | |
# root directory of your rails app, but the public directory of the | |
# rails app root directory. But that's how it is! | |
# Don't forget the semicolon at the end of the line!!! | |
############################################################################ | |
root /var/www/testapp/public; | |
try_files $uri/index.html $uri.html $uri @app; | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
################################# | |
# Edit here too! | |
################################# | |
root /var/www/testapp/public; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment