Created
March 1, 2012 16:04
-
-
Save keighl/1950820 to your computer and use it in GitHub Desktop.
NGINX Configuration / Passenger + Rails
This file contains 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; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
passenger_root /home/USER/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11; | |
passenger_ruby /home/USER/.rvm/wrappers/ruby-1.9.2-p290/ruby; | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_proxied any; | |
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
# Rewrite ! | |
server { | |
listen 80; | |
server_name example.com; | |
rewrite ^/(.*) http://www.example.com$request_uri? permanent; | |
} | |
server { | |
listen 80; | |
server_name www.example.com; | |
root /home/USER/example.com/public; | |
rails_env production; | |
client_max_body_size 10M; | |
passenger_friendly_error_pages on; | |
passenger_enabled on; | |
location ~ ^/(assets)/ { | |
expires 1y; | |
add_header Cache-Control public; | |
add_header ETag ""; | |
break; | |
} | |
} | |
# Default | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment