server { listen *:80; location / { root /usr/local/nginx/html; index index.html index.php; # if file exists return it right away if (-f $request_filename) { break; } # otherwise rewrite the fucker if (!-e $request_filename) { rewrite ^(.+)$ /index.php$1 last; break; } } # if the request starts with our frontcontroller, pass it on to fastcgi location ~ ^/index.php { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; } }