php限定能执行的php目录以及路径
server {
listen 80;
server_name www.sdph.org.cn sdph.org.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/yixuehui1/public;
location ~* ^/(static|uploads|upload|images|cache|tmp|css|js)/.*.(php|php5)$ {
deny all;
}
location = /index.php {
# 允许执行 index.php 文件
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/php-cgi-73.sock;
}
location ^~ /runtime/ {
# 允许执行 runtime 目录中的 PHP 文件
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # 根据你的 PHP-FPM 配置调整
}
location ~ \.php$ {
deny all;
}
# 其他配置项...
}