Created
April 21, 2015 02:07
-
-
Save breim/07b34b0f482942666877 to your computer and use it in GitHub Desktop.
Best nginx configuration for rails and passenger
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 2; | |
worker_rlimit_nofile 100000; | |
error_log /home/cdeploy/error.log; | |
events { | |
worker_connections 768; | |
use epoll; | |
multi_accept on; | |
} | |
http { | |
passenger_root /home/cdeploy/.rvm/gems/ruby-2.0.0-p643/gems/passenger-5.0.6; | |
passenger_ruby /home/cdeploy/.rvm/gems/ruby-2.0.0-p643/wrappers/ruby; | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 30; | |
tcp_nopush on; | |
tcp_nodelay on; | |
open_file_cache max=50000 inactive=20s; | |
open_file_cache_valid 30s; | |
open_file_cache_min_uses 2; | |
open_file_cache_errors on; | |
reset_timedout_connection on; | |
client_body_timeout 10; | |
send_timeout 2; | |
large_client_header_buffers 4 256k; | |
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m; | |
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=30r/s; | |
limit_conn conn_limit_per_ip 20; | |
limit_req zone=req_limit_per_ip burst=20; | |
server { | |
listen 80; | |
server_name 54.207.84.57; | |
root /home/cdeploy/teaser/public; | |
passenger_enabled on; | |
limit_conn conn_limit_per_ip 30; | |
limit_req zone=req_limit_per_ip burst=10 nodelay; | |
location ~/img { | |
limit_conn conn_limit_per_ip 999; | |
limit_req zone=req_limit_per_ip burst=999 nodelay; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} | |
client_body_buffer_size 128k; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment