Skip to content

Instantly share code, notes, and snippets.

@aliharis
Last active September 13, 2020 13:34
Show Gist options
  • Save aliharis/1821ee2f4b62f40fcf306ea22d5da837 to your computer and use it in GitHub Desktop.
Save aliharis/1821ee2f4b62f40fcf306ea22d5da837 to your computer and use it in GitHub Desktop.
statamic nginx config
server {
listen 80;
root /var/www/cms/public;
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log on;
error_log /var/log/nginx/example.com-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
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;
}
# Enable gzip compression
# gzip on;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment