Last active
August 29, 2015 14:05
-
-
Save nobodyiscertain/23ef7186c453402c99c5 to your computer and use it in GitHub Desktop.
nginx Config for Statamic 1.8.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name example.com; | |
root /var/www/example.com/public; | |
index index.php; | |
access_log /var/www/example.com/logs/access.log; | |
error_log /var/www/example.com/logs/error.log; | |
add_header "X-Built-With" "Statamic"; | |
location ~ /\.ht { | |
deny all; | |
return 403; | |
} | |
location ~ /(_app|_config|_content|\.git) { | |
deny all; | |
return 403; | |
} | |
location ~ /.(yml|yaml|html) { | |
deny all; | |
return 403; | |
} | |
# 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 /index.php?$args; | |
expires max; | |
access_log off; | |
add_header Pragma public; | |
add_header Cache-Control "max-age=2678400, public, must-revalidate, proxy-revalidate"; | |
} | |
# 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; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
try_files $uri =404; | |
# With php5-fpm: | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment