This is what our expert implemented:
server_name_in_redirect off;
root /var/www/cache/nginx;
index index.html;
error_page 566 = @post;
if ($request_method = POST) { return 566; }
if ($is_args = "?") {
return 566;
}
set $original_uri $uri;
if ($uri = /) { set $original_uri "index.html"; }
#if ($uri = /) { return 566; }
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
root /var/www/html;
}
location ~* \.(ico|pdf|flv)$ {
expires 1y;
root /var/www/html;
error_page 404 = @stor;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt|svg|pdf)$ {
expires 14d;
root /var/www/html;
error_page 404 = @stor;
}
location / {
#try_files /var/www/cache/nginx/$original_uri @stor;
default_type text/html;
error_page 403 404 = @stor;
}
server_name_in_redirect off;
root /var/www/cache/nginx;
index index.html;
error_page 566 = @post;
if ($request_method = POST) { return 566; }
if ($is_args = "?") {
return 566;
}
set $original_uri $uri;
if ($uri = /) { set $original_uri "index.html"; }
#if ($uri = /) { return 566; }
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
root /var/www/html;
}
location ~* \.(ico|pdf|flv)$ {
expires 1y;
root /var/www/html;
error_page 404 = @stor;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt|svg|pdf)$ {
expires 14d;
root /var/www/html;
error_page 404 = @stor;
}
location / {
#try_files /var/www/cache/nginx/$original_uri @stor;
default_type text/html;
error_page 403 404 = @stor;
}