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

相关推荐
SilentSamsara2 小时前
concurrent.futures 实战:进程池与线程池的统一抽象
运维·开发语言·python·青少年编程
疯狂成瘾者2 小时前
常见的 Linux 版本
linux·运维·服务器
xingyuzhisuan3 小时前
GPU服务器集群搭建指南——选型、部署、优化+避坑全解析
运维·服务器·人工智能·gpu算力
tianrun12343 小时前
Ubuntu 24.04 安装 Fcitx5 + Rime + 搜狗词库(替代 IBus 与 Linux 搜狗输入法)
linux·运维·ubuntu
2601_955256473 小时前
云服务器采购避坑指南:如何通过官方渠道获得更低折扣与更快服务
运维·服务器
秋落风声3 小时前
内存池仿Nginx C++实现
c++·nginx
清欢渡---3 小时前
三次握手四次挥手(对话场景)
运维·服务器·网络·hcia
YIN_尹4 小时前
【Linux 系统编程】手撕一个简易版的shell命令行解释器
android·linux·运维
小脑斧1234 小时前
从入门到精通:Linux 进程间通信 IPC 全解析|管道、共享内存、信号量、消息队列实战
linux·运维·服务器
難釋懷4 小时前
Nginx反向代理
运维·nginx