user nginx; worker_processes 2; events { use epoll; worker_connections 1024; } http { include conf/mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; upstream mongrel { server 127.0.0.1:8000; server 127.0.0.1:8001; } server { listen 80; server_name eveel.kicks-ass.org; charset off; location / { root /srv/www/nginx/kopa.info; index index.html index.htm; } # serve the /files/ catalog as static location ~ /public/* { root /srv/www/nginx; autoindex on; } # / -> first search for local index.html then go to mongrel location ~ ^/$ { if (-f /index.html) { rewrite (.*) /index.html last; } proxy_pass http://mongrel; } # rails caching: searching first for $action.html local pages location / { if (!-f $request_filename.html) { proxy_pass http://mongrel; } rewrite (.*) $1.html last; } # serve static files directly location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|html|xhtml|js|mov)$ { root /srv/www/nginx/kopa.info/public; } # resend everything else to mongrel location / { proxy_pass http://mongrel; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } server { listen 8080; server_name eveel.kicks-ass.org; charset off; # serve the public catalog as static location ~ /public/* { root /srv/www/nginx; autoindex on; } # root folder location / { root /srv/www/nginx/spectrum; index index.php index.xhtml index.html index.htm; autoindex off; } # redirect to php-fastcgi location ~ .php$ { fastcgi_intercept_errors on; fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME srv/www/nginx/spectrum$fastcgi_script_name; include /etc/nginx/conf/fastcgi.conf; } } }