user www-data www-data; worker_processes 3; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; gzip on; upstream mongrel { server 127.0.0.1:8000; server 127.0.0.1:8001; server 127.0.0.1:8002; } server { listen 80; #listen 192.168.1.1; #listen 192.168.1.1:8080; server_name php.mydomain.com; #access_log logs/host.access.log main; location / { root /var/www/phpmyadmin; index index.html index.htm index.php; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_pass 127.0.0.1:8888; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/phpmyadmin$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; } } #Rails App here server { listen 80; root /var/www/railsapp/public; index index.html index.htm; server_name www.railsapp.net railsapp.net; client_max_body_size 50M; access_log /var/log/nginx/localhost.access.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded_for $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; proxy_max_temp_file_size 0; if (-f $request_filename) { break; } if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://mongrel; break; } } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/railsapp/public; } } }