server { listen *:80; server_name testhost.com; root /var/www/intervid/root; access_log /var/log/nginx/intervid.log main; index index.php; error_page 404 /index.php; client_max_body_size 100M; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } location ~ \..*/.*\.php$ { return 403; } location ~* files/styles { access_log off; expires max; try_files $uri @rewrite; } location / { try_files $uri $uri/ @rewrite; expires max; } location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.www.sock; include /etc/nginx/fastcgi-params.conf; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* ^.+\.(txt|css|jpg|html|gif|png|js|swf|xml)$ { expires max; log_not_found off; } }