2.5 Apache禁止解析phpphp
ls -l /data/www/data (能夠看到所屬主都是daemon)
chrome
cd /data/www/data/p_w_upload/forum/apache
能夠看到剛剛從本地上傳到discuz網站上的圖片vim
訪問的時候403,是由於以前作了防盜鏈,把以前作的防盜鏈註釋掉就能夠了瀏覽器
如今把php解析引擎關掉,不讓它解析了,而且在作一個限制,不能解析了,但還能夠訪問,訪問的時候能夠把源代碼下載走,這樣子是不行的curl
cd /data/www/dataide
vim info.php網站
<?php搜索引擎
phpinfourl
?>
apachectl restart
到瀏覽器去訪問 www.test.com/data/info.php是直接下載的
把php_admin_flag engine off註釋掉,就能夠在www.test.com/data/info.php正常解析了
不讓把php文件下載,直接禁用掉
把(.*)php這些文件均可以註釋掉,把上面註釋的行都打開,在Apachectl restart,再來
www.test.com/data/info.php就會403了
再curl -x127.0.0.1:80 www.test.com/data/info.php不會解析出來
2.6 Apache 禁止指定user_agent
也用到以前的rewrite模塊,沒有必要的搜索引擎curl、chrome禁止掉了,【NC】是不區分大小寫,【F】就是forbidden,這樣curl、chrome都會出現403,OR或者
curl -x127.0.0.1:80 www.test.com/forum.php -I 會是403
curl -A "adsasfafsdchrome dasdasd" -x192.168.3.X:80 www.test.com/forum.php -I 也是403
2.7 Apache經過rewrite限制某個目錄
在/data/www/tmp/建立了一個gg.txt,而後能夠正常的在瀏覽器訪問www.test.com/tmp/gg.txt,增長了條件和規則,再到瀏覽器訪問就403了