Skip to content

Instantly share code, notes, and snippets.

@mschultheiss83
Created August 23, 2013 15:23
Show Gist options
  • Save mschultheiss83/6320568 to your computer and use it in GitHub Desktop.
Save mschultheiss83/6320568 to your computer and use it in GitHub Desktop.
server {
set $domain 'yourdomain.com';
server_name $domain;
root /home/$domain/public;
access_log /home/$domain/logs/access.log;
error_log /home/$domain/logs/error.log;
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;
expires max;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# Deny access to configuration files
location ~* ^/_config {
deny all;
return 404;
}
location ~ /(_app|_config|_content|/layouts/) {
deny all;
return 404;
}
location ~ /.(yml|yaml|html) { deny all; }
# Return a static file, if it exists, or pass to front controller
location / {
rewrite ^/admin.php.*$ /admin.php;
try_files $uri $uri/ /index.php$args;
}
# Pass PHP requests on to PHP-FPM
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment