Optimized Configuration for NGINX and Ruby on Rails
Enable gzip compression
Speeds up spawn time tremendously
Keep the spawners alive, which speeds up spawning a new Application
Let nginx handle assets and caching
Disble logs when accessing assets
To test compression:
curl --head -H "Accept-Encoding: gzip" http://example.com
passenger_root /Users/altair/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12;
passenger_ruby /Users/altair/.rvm/wrappers/ruby-1.9.3-p194/ruby;
passenger_spawn_method smart;
rails_app_spawner_idle_time 0;
rails_framework_spawner_idle_time 0;
passenger_pool_idle_time 1000;
passenger_max_pool_size 2;
gzip on;
gzip_http_version 1.1;
gzip_comp_level 1;
gzip_proxied any;
gzip_vary on;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server {
listen 2500;
server_name localhost;
passenger_enabled on;
root /Users/martiancrafts/Documents/www/build_server/public/;
#rails_env development;
location ~ ^/assets/ {
access_log /dev/null;
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
}
No comments:
Post a Comment