Last active
September 13, 2020 13:34
-
-
Save aliharis/1821ee2f4b62f40fcf306ea22d5da837 to your computer and use it in GitHub Desktop.
statamic nginx config
This file contains 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 { | |
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