Skip to content

Instantly share code, notes, and snippets.

@Narnach
Created October 14, 2009 20:26
Show Gist options
  • Select an option

  • Save Narnach/210368 to your computer and use it in GitHub Desktop.

Select an option

Save Narnach/210368 to your computer and use it in GitHub Desktop.
nginx config file
# This config works great to run my Sinatra app over Phusion Passenger,
# but it does not use my custom static error pages for 404 and 50x errors.
# Any help in getting it to work is much appreciated!
worker_processes 1;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 65;
gzip on;
gzip_min_length 800;
gzip_buffers 4 8k;
gzip_comp_level 1;
gzip_types text/plain text/css text/javascript;
gzip_disable "MSIE [1-6]\.";
passenger_root /usr/local/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/passenger-2.2.5;
passenger_ruby /usr/local/ruby-enterprise-1.8.7-20090928/bin/ruby;
passenger_max_pool_size 4;
server {
server_name www.example.com;
rewrite ^(.*) http://example.com$1 permanent;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}
server {
listen 80;
server_name example.com;
charset utf-8;
access_log /var/log/nginx/example.com.access.log main;
root /var/www/www.example.com/public;
passenger_enabled on;
passenger_use_global_queue on;
rack_env production;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment