Nginx Vhost template
server {
listen 80;
server_name local.dev;
access_log /var/log/nginx/nginx.access.log;
root /media/sf_SITIOS;
index index.php index.html;
# Don't cache rules
if ($request_uri ~* "/(folder/|file.php)")
{
set $no_cache 1;
}
# PHP FPM
location ~* \.php$ {
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
#fastcgi_cache Nginx;
fastcgi_cache_valid 200 5m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
add_header X-Cache $upstream_cache_status;
}
location ~* /{
autoindex off;
}
# Cache static files such as images, styles and scripts
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 60m;
}
# Health test
if ($request_uri ~* "^/ok$") {
return 200;
}
# Block all svn access
if ($request_uri ~* "/\.svn") {
return 404;
}
# Block all git access
if ($request_uri ~* "/\.git") {
return 404;
}
}