server {
listen 80;
server_name www.test.com test.com;
##LOGS
access_log off;
error_log /srv/www/test/logs/www.test.com.error_log;
##Document Root
root /srv/www/test/html/test.com/public;
##Default Index
index index.php index.html index.htm;
##Security
if ( $request_method !~ ^(GET|HEAD|POST)$ ){
return 444;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Block access to .htaccess
location ~ \.htaccess {
deny all;
}
location ~\.php$ {
try_files $uri = 404;
fastcgi_pass unix:/var/run/php5-fpm/test.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param TMP /srv/www/test/tmp;
fastcgi_param TMPDIR /srv/www/test/tmp;
fastcgi_param TEMP /srv/www/test/tmp;
include fastcgi_params;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* ^.+.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$ {
expires 31d;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}