具体方法:
(推荐教程:nginx教程)
限制php解析
根据目录来限制php解析:
location ~ .*(diy|template|attachments|forumdata|attachment|image)/.*\.php${ deny all;}
限制浏览器访问
使用 user_agent 控制客户端浏览器访问
location / { if ($http_user_agent ~ 'bingbot/2.0|mj12bot/v1.4.2|spider/3.0|youdaobot|tomato|gecko/20100315'){ return 403; }}
相关推荐:php培训
以上就是nginx如何设置禁止解析php文件的详细内容。
