Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
mod_security – unethost無限空間虛擬主機 技術分享部落格

apache mod_security關閉單一網域

有一些程式,例如Ecshop,遇到apache mod_security這個模組,ecshop的舊版本,會有不相容的情況。這種時候,如果客戶不願意升級,我必須採取的處理方式,就是針對該客戶的單一網域,關閉apache mod_security

要針對單一網域關閉apache的mod_security,根據我的測試,無法使用.htaccess檔來做,會當掉。一定要直接把相關的指令,寫在apache的config檔裡。而cpanel/WHM的apache config檔,是配合GUI自動生成的,不能隨便修改。所以這個改法,必須考慮cpanel的檔案配置。方法如下:

mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com

然後生成檔案:

/usr/local/apache/conf/userdata/std/2/username/domain.com/mod_security.conf

在這個檔案中,加入:

<IfModule mod_security2.c> SecRuleEngine Off </IfModule>

存檔

然後,執行:

/scripts/ensure_vhost_includes --user=username

其中,username是cpanel的使用者名稱,而domain.com是網域名稱。