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 可以正常。 先能用就行,没能力找到问题根源。

相关推荐
小HANN31 分钟前
高可用架构实战:Keepalived+LVS(DR)+MariaDB主主集群搭建指南
linux·运维·服务器·经验分享
Sylvia-girl1 小时前
【一】:Linux基础指令
linux·运维·服务器
KKKlucifer1 小时前
运维域与IT域融合——云网安全一体化运营体系建设
大数据·运维·安全
0+1111 小时前
Linux --基础IO
linux·运维·服务器
资深电气设计1 小时前
雕铣机主轴驱动升级趋势分析:变频器技术价值与选型逻辑探讨
运维
名字还没想好☜2 小时前
Prometheus 告警实战:写 alerting rules、用 Alertmanager 做路由分组与抑制
运维·前端·javascript·docker·kubernetes·prometheus
Zkaisen2 小时前
【Gitee】SSH 公钥、GPG 公钥、私人令牌的区别
运维·gitee·ssh
HXSYS2 小时前
无人机库房管理标准化,《无人机装调维修师》规范存储运维
运维·无人机
牢姐与蒯2 小时前
Linux进程(四).进程优先级以及进程切换,进程调度
linux·运维·服务器·ubuntu
yyuuuzz3 小时前
企业出海云服务器部署踩坑记录:从频繁超时到稳定运行的复盘
运维·服务器·网络·人工智能·aws