- NGINX Cookbook
- Tim Butler
- 176字
- 2021-07-03 00:04:24
How it works...
Based on a simple PHP-FPM structure, we make a few key changes specific to the Drupal environment. The first change is as follows:
location ~ (^|/)\. { return 403; }
We put a block in for any files beginning with a dot, which are normally hidden and/or system files. This is to prevent accidental information leakage:
location ~ /vendor/.*\.php$ { deny all; return 404; }
Any PHP file within the vendor directory is also blocked, as they shouldn't be called directly. Blocking the PHP files limits any potential exploit opportunity which could be discovered in third-party code.
Lastly, Drupal 8 changed the way the PHP functions are called for updates, which causes any old configuration to break. The location directive for the PHP files looks like this:
location ~ \.php$|^/update.php {
This is to allow the distinct pattern that Drupal uses, where the PHP filename could be midway through the URI.
We also modify how the FastCGI process splits the string, so that we ensure we always get the correct answer:
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
- Learning Python Web Penetration Testing
- 深入淺出Spring Boot 2.x
- Mastering Kotlin
- Java:Data Science Made Easy
- Hands-On JavaScript High Performance
- 區(qū)塊鏈:以太坊DApp開發(fā)實戰(zhàn)
- Learning OpenStack Networking(Neutron)(Second Edition)
- Access 2010數(shù)據(jù)庫應(yīng)用技術(shù)(第2版)
- C語言程序設(shè)計
- 一塊面包板玩轉(zhuǎn)Arduino編程
- Python+Tableau數(shù)據(jù)可視化之美
- BeagleBone Robotic Projects(Second Edition)
- 分布式架構(gòu)原理與實踐
- R語言數(shù)據(jù)挖掘:實用項目解析
- Python硬件編程實戰(zhàn)