Created
April 11, 2016 20:43
-
-
Save atomicpages/d312614b27c37b785d8f5457827a6373 to your computer and use it in GitHub Desktop.
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 { | |
listen 80; | |
listen [::]:80 default_server ipv6only=on; | |
index index.php index.html index.htm; | |
## Begin - Server Info | |
root /var/www; | |
server_name localhost; | |
## End - Server Info | |
## Begin - Index | |
# for subfolders, simply adjust: | |
# `location /subfolder {` | |
# and the rewrite to use `/subfolder/index.php` | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
## End - Index | |
## Begin - PHP | |
location ~ \.php$ { | |
# try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
# fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; | |
} | |
## End - PHP | |
## Begin - Security | |
# deny all direct access for these folders | |
location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; } location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; } | |
# deny running scripts inside user folder | |
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; } | |
# deny access to specific files in the root folder | |
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; } | |
## End - Security | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment