server { listen *:80; server_name domain.tld *.domain.tld; access_log /path/to/log/access.log; error_log /path/to/log/error.log debug; client_max_body_size 6M; location / { root /path/to/webroot; index index.php index.htm index.html; # this serves static files that exist without running other rewrite tests if (-f $request_filename) { expires 30d; break; } # this sends all non-existing file or directory requests to index.php if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; } } # if the request starts with our frontcontroller, pass it on to fastcgi location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /path/to/webroot$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include /etc/nginx/fastcgi_params; } }