官术网_书友最值得收藏!

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)(|/.*)$; 
主站蜘蛛池模板: 巴青县| 汝阳县| 察哈| 探索| 石阡县| 阜宁县| 阿荣旗| 揭阳市| 饶阳县| 南召县| 工布江达县| 金昌市| 葫芦岛市| 松潘县| 通辽市| 永福县| 渭南市| 阿拉善左旗| 南郑县| 泽州县| 松溪县| 卫辉市| 潼南县| 贵南县| 华安县| 大方县| 平乐县| 罗江县| 黑山县| 玉环县| 南通市| 苏州市| 南涧| 昌黎县| 阜平县| 和静县| 砀山县| 长治市| 凤冈县| 合江县| 逊克县|