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

相关推荐
暖核4 分钟前
Linux实战入门:从零编写第一个Bash Shell脚本
linux·运维·bash
云原生指北7 分钟前
Docker Sandboxes 的隔离例外:共享 Skills 与宿主机 MCP
运维·docker·ai·容器·agent
2301_7867566019 分钟前
不做分子仿真、不布局自动化实验室,垂直科研智能平台同样跑通 AI for Science 可持续变现
运维·人工智能·自动化
志栋智能28 分钟前
超自动化安全如何提升合规与审计效率?
运维·安全·自动化
March.s34 分钟前
深入理解 Linux 系统启动原理
linux·运维·服务器
zbyyd1 小时前
Linux 基础与 Shell 命令
linux·运维·arm开发
起名真的太难了1 小时前
Linux系统运维与远程管理核心命令速查指南
linux·运维·服务器
酷可达拉斯1 小时前
自动化运维-Ansible Role详解
linux·运维·服务器·自动化·ansible
智能运维指南2 小时前
智能体自治运维选型指南:2026年企业如何从“AI辅助”走向“AI自治”
大数据·运维·人工智能
suijishengchengde2 小时前
k8s deployment或statefulset分组关停
运维·kubernetes