Created
July 25, 2023 14:34
-
-
Save trk/5ff33a525cd8a651586012ed6c201e5c to your computer and use it in GitHub Desktop.
ProcessWire-RunCloud-Nginx-Custom-Config
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
# Block access to any file or directory that begins with a period | |
location ~ /\. { | |
deny all; | |
} | |
# Block access to any software identifying txt files | |
location ~ /(COPYRIGHT|LICENSE|README|htaccess)\.txt { | |
deny all; | |
} | |
# Block access to protected assets directories | |
location ~ ^/site(-[^/]+)?/assets/(.*\.php|backups|cache|config|install|logs|sessions|tmp) { | |
deny all; | |
} | |
# Block acceess to the /site/install/ directory | |
location ~ ^/site(-[^/]+)?/install { | |
deny all; | |
} | |
# Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php | |
location ~ ^/(site(-[^/]+)?|wire)/(config(-dev)?|index\.config)\.php { | |
deny all; | |
} | |
# Block access to any PHP files in /site/modules/ | |
location ~ ^/((site(-[^/]+)?|wire)/modules|wire/core)/.*\.(inc|module|php|tpl) { | |
deny all; | |
} | |
# Block access to any PHP or markup files in /site/templates/ | |
location ~ ^/(site(-[^/]+)?|wire)/templates(-admin)?/.*\.(inc|html?|php|tpl) { | |
deny all; | |
} |
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
# Pass the PHP scripts to FastCGI server on local socket | |
location ~ .+\.php((/|\?).*)?$ { | |
fastcgi_index index.php; | |
# Fix for server variables that behave differently under nginx/php-fpm than typically expected | |
fastcgi_split_path_info ^(.+\.php)(.*)$; | |
# Hides warnings on install | |
fastcgi_param HTTP_MOD_REWRITE On; | |
# Set environment variables | |
include fastcgi_params; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
fastcgi_param DOCUMENT_ROOT $realpath_root; | |
fastcgi_pass unix:/var/run/php/app-stack-name.sock; | |
} |
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
try_files $uri $uri/ /index.php?it=$uri&$args; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment