Skip to content


apache关闭某目录的PHP解析

可以在http.conf的目录区域增加”php_flag engine”参数,关闭对某个目录的php解析,起到保护的作用。

  1. <VirtualHost *:80>
  2.     DocumentRoot /opt/htdocs/www
  3.     ServerName local.c1gstudio.com
  4.  
  5. <Directory "/opt/htdocs/www/truck>
  6.     php_flag engine Off
  7.     AddOutputFilterByType DEFLATE text/html text/plain text/xml
  8. </Directory>
  9. </VirtualHost>

 

关闭后php文件将会变成可下载的纯文本文件,所以请小心使用。

Posted in Apache, PHP, 技术.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.