要禁止 Nginx 运行 PHP,可以按照以下步骤进行操作:
/etc/nginx/nginx.conf
或 /etc/nginx/sites-available/default
。server
块中找到包含 location ~ \.php$
的配置段。#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# # fastcgi_pass 127.0.0.1:9000;
#}
sudo nginx -s reload
。完成以上步骤后,Nginx 将不再处理以 .php
结尾的请求,从而禁止运行 PHP。
上一篇:php怎么去掉数组中的空值
下一篇:php如何设置数组
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站