lnmp取消nginx目录PHP执行权限
首先要编辑nginx的虚拟主机配置,在fastcgi的location语句的前面按下面的内容添加:
1、单个目录去掉PHP执行权限
location ~ /attachments/.*\.(php|php5)?$ {
deny all;
}
将attachments目录的PHP执行权限去掉。
2、多个目录去掉PHP执行权限
location ~ /(attachments|upload)/.*\.(php|php5)?$ {
deny all;
}
将attachments、upload这二个目录的PHP执行权限去掉。
附上一个完整的虚拟主机的例子供参考:
server
{
listen 80;
server_name www.45it.com;
index index.html index.htm index.php;
root /home/wwwroot/bbs.vpser.net;include discuz.conf;
location ~ /(attachments|upload)/.*\.(php|php5)?$ {
deny all;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
access_log off;
}
添加完执行:/usr/local/nginx/sbin/nginx -t测试配置文件,执行:/usr/local/nginx/sbin/nginx -s reload 载入配置文件使其生效。
注:注意顺序,一定要放在 “location ~ .*\.(php|php5)?$” 一行上面,不然不会生效。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools
