Skip to content

Instantly share code, notes, and snippets.

@brunoandradd
Created September 24, 2012 17:50
Show Gist options
  • Save brunoandradd/3777274 to your computer and use it in GitHub Desktop.
Save brunoandradd/3777274 to your computer and use it in GitHub Desktop.
Config nginx com php/ruby
worker_processes 3;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.7;
passenger_ruby /usr/local/bin/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 130;
gzip on;
client_max_body_size 10M;
client_body_buffer_size 128k;
#ruby
server {
listen 3000;
server_name <server_name>;
root <rails_public_dir>;
passenger_enabled on;
passenger_min_instances 3;
rails_env production;
}
#php
server {
listen 80;
server_name <server_name>;
root <php_dir>;
access_log logs/access.log;
error_log logs/error.log;
location / {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|swf)$ {
expires 30d;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
} 9,1 15%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment