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

相关推荐
会飞的土拨鼠呀1 小时前
Linux 真实内存使用率的核心计算标准
linux·运维·服务器
小小谈电商2 小时前
2026 年 8 月|国内企业级商城源码服务商全方位测评报告
大数据·运维·小程序
hxhy002 小时前
异地组网实战:从 frp 中转到 Tailscale 直连,SSH 延迟 410ms → 29ms
运维·ssh
志栋智能2 小时前
从安全超自动化到超自动化安全的认知飞跃
运维·安全·自动化
当代红领巾2 小时前
VMware 里装好 Linux 系统没有 ipv4 地址?
linux·运维·服务器
ailsa_hui3 小时前
给50人的电子厂上数智云平台,大概要多少预算?
大数据·运维·人工智能
wzq11_6664 小时前
HDFS集群的高可用集群一遍过!!!
运维·debian
Vcaker4 小时前
Linux学习22-openstack部署与使用
linux·运维·学习
小周学学学4 小时前
vmware-horizon第四章:事件数据库配置(docker)
运维·docker·容器
姓刘的哦4 小时前
STM32的启动流分析
linux·运维·arm开发