Nginx Conf on OSX

Posted by admin Tue, 11 Dec 2007 01:45:00 GMT

I am Using this configuration to run Nginx on my Mac Book with three mongrels running on ports 5001-5004

worker_processes 2; error_log logs/error.log notice;
pid logs/nginx.pid;
events {
worker_connections 1024;
}

http {
include conf/mime.types;
default_type application/octet-stream;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
upstream mongrel {
server 127.0.0.1:5001;
server 127.0.0.1:5002;
server 127.0.0.1:5003;
}
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
server {
listen 80;
root /Path/to/Rails/App/public;
access_log off;
rewrite_log on;
location ~ ^/$ {
if (-f /index.html){
rewrite (.*) /index.html last;
}
proxy_pass http://mongrel;
}
location / {
if (!-f $request_filename.html) {
proxy_pass http://mongrel;
}
rewrite (.*) $1.html last;
}
location ~ .html {
root /Path/to/Rails/App/public;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|
pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
root /Path/to/Rails/App/public;
}

location / {
proxy_pass http://mongrel;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}
}

Posted in  | Tags ,  | no comments

Older posts: 1 ... 5 6 7