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

相关推荐
liuyicenysabel8 分钟前
Flask 个人站 iProfile 上线笔记(k3s + Nginx + Let‘s Encrypt)
笔记·nginx·flask
爱和冰阔落32 分钟前
【Linux】Ctrl+C 到底做了什么?从键盘、kill 到 alarm,一次讲清信号的产生
linux·运维·c++·安卓
JavaPub-rodert1 小时前
Linux 下部署 MongoDB:从安装、配置到生产环境使用
linux·运维·mongodb
画中有画2 小时前
自动化脚本中如何启动/打开app的某个页面
运维·自动化
我星期八休息2 小时前
Linux—五种IO模型与非阻塞IO
linux·运维·服务器·网络·数据库·网络协议
hweiyu002 小时前
Linux命令:column
linux·运维·服务器
日常筹谋记3 小时前
ATS选不对运维两行泪:数据中心市电与柴发切换场景的双电源自动转换开关选型笔记
运维·数据库·笔记
绿蚁新亭3 小时前
Markdown Wiki 网页代码块复制至欧拉 Linux Shell 脚本隐形字符故障完整复盘
linux·运维·服务器
mengge.cloud3 小时前
LVS 小白完整教程(Linux虚拟服务器负载均衡)
linux·运维·服务器·负载均衡·lvs
江湖有缘3 小时前
跨平台AI终端Wave:智能SSH与文件管理
运维·人工智能·ssh