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

相关推荐
虎头金猫10 小时前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
还是大剑师兰特11 小时前
解决nginx错误:http://localhost:7000正常,http://localhost:7000/map 报错404
nginx·大剑师
AI职业加油站12 小时前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏13 小时前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
xing-xing13 小时前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
-梅13 小时前
linux(8) 软硬链接
linux·运维·服务器
张洛闻Eren14 小时前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
其实防守也摸鱼14 小时前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
布裘14 小时前
【银河麒麟】V4桌面图标消失,右击鼠标没反应排查
运维·银河麒麟·桌面环境
懂软件的胡子个哥15 小时前
微信机器人为什么需要“回复候选”而不是所有 AI 内容直接发送
运维·微信·自动化·wechatapi·个人微信号二次开发