Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- server_name example.com;
- root /var/www/example.com/public/;
- ssl_protocols TLSv1.2;
- index index.html index.htm index.php;
- charset utf-8;
- # Dynamically set the try_files locations.
- # Statically cached files should only be loaded for GET requests.
- set $try_files @default;
- if ($request_method = GET) {
- set $try_files @static;
- }
- # The files to try when its a potentially static cache request (ie. a GET request)
- location @static {
- try_files /static${uri}_${query_string}.html @default;
- }
- # The files to try when it's not a static cache request (ie. anything other than GET)
- location @default {
- try_files $uri $uri/ /index.php?$query_string;
- }
- location / {
- try_files $uri $try_files; # Use the dynamically assigned locations from above.
- }
- location = /favicon.ico { access_log off; log_not_found off; }
- location = /robots.txt { access_log off; log_not_found off; }
- access_log off;
- error_log /var/log/nginx/example.com-error.log error;
- error_page 404 /index.php;
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- }
- # Block access to hidden files (except the /.well-known/ dir)
- location ~ /(?!.well-known)(\.)\w+ {
- deny all;
- }
- # Block access to content/data files
- location ~* /(.*)\.(?:md|yaml|textile)$ {
- deny all;
- return 404;
- }
- # Block access to the Statamic app
- location ^~ /statamic {
- deny all;
- return 404;
- }
- # Enable gzip compression
- # gzip on;
- # gzip_min_length 1100;
- # gzip_buffers 4 32k;
- # gzip_types text/plain application/x-javascript text/xml text/css;
- # gzip_vary on;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement