php5 php8 nginx Access denied.

服务器:nginx+php-fpm (php5.6)

有个php文件不能在 php5.6 下工作, 另安装 php8-fpm

配置:

复制代码
location ~ .*\.php8$
{
	try_files $uri =404;
	fastcgi_pass  unix:/tmp/php-cgi8.sock;
	fastcgi_index index.php;
	include fcgi.conf; break;
}

location ~ .*\.(php|php5)?$
{
	try_files $uri =404;
	fastcgi_pass  unix:/tmp/php-cgi5.6.sock;
	fastcgi_index index.php;
	include fcgi.conf;
}

浏览器打开程序,显示 Access denied. 403错误;

把原来正常工作的 .php 文件后缀改为 .php5, 也是 Access denied.

文件后缀 改成 .ph8 .8php .8ph 都是 Access denied. 四处找资料,没有找到解决办法。

把 文件名改成 .8.php 然后配置:

复制代码
location ~ .*\.8\.php$
{
	try_files $uri =404;
	fastcgi_pass  unix:/tmp/php-cgi8.sock;
	fastcgi_index index.php;
	include fcgi.conf; break;
}

浏览器打开 localhost/test.8.php 可以正常。 先能用就行,没能力找到问题根源。

相关推荐
考琪9 小时前
Nginx打印变量到log方法
java·运维·nginx
SAP工博科技10 小时前
SAP 公有云 ERP 多工厂多生产线数据统一管理技术实现解析
大数据·运维·人工智能
YongCheng_Liang10 小时前
从零开始学虚拟化:桌面虚拟化(VDI)入门指南(架构 + 产品 + 部署)
运维·云计算
杜子不疼.10 小时前
【Linux】库制作与原理(二):动态库的制作与使用
linux·运维·服务器
消失的旧时光-194310 小时前
Nginx 是什么?为什么它不写在代码里?——从 0 认识 Nginx
运维·服务器·nginx
BJ_Bonree10 小时前
4月17日,博睿数据受邀出席GOPS全球运维大会2026 · 深圳站!
大数据·运维·人工智能
RisunJan10 小时前
Linux命令-lpq(查看打印队列状态)
linux·运维·服务器
山君爱摸鱼10 小时前
Linux-服务进程
linux·运维·服务器
阿乐艾官10 小时前
【linux文件系统重要目录及命令解释】
linux·运维·服务器
senijusene10 小时前
Linux软件编程: Linux 操作系统基础与shell脚本
linux·运维·chrome