

多nginx单php-fpm的配置方法
source link: https://blogread.cn/it/article/598?f=hot1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

多nginx单php-fpm的配置方法
用php fastcgi和nginx搭配的形式是很常见的,在很BT的需求下,可能会需要多个nginx走不同的端口,而进程只用一个php-fpm。
本文所讲的环境比上述一句话还要BT,存在一个php-fpm,而且每个nginx都以一个非超级用户所有来进行运行。
这样就存在了一个BT的情况,php-fpm默认不能以root权限运行,而普通用户来运行的话,对其他用户的目录,php-fpm将没有权限,页面在运行php的时候,会提示404。
于是有以下的解决方案:
找到php的源代码 $src_path/sapi/cgi/fpm/fpm_unix.c
在文件顶部增加一个宏定义:#define I_REALLY_WANT_ROOT_PHP
重新 configure make make install
此时再修改php-fpm.conf 将user group都修改成root(经过上面的修改php-fpm已经支持root了)。
重启php-fpm.
配置各nginx.conf:
location ~ .*\\.(php|php5)?$
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
点到即止,不再多说。。。
建议继续学习:
扫一扫订阅我的微信号:IT技术博客大学习
Recommend
-
11
一、改动php.ini 最近使用PhpMyAdmin导入一个1.5M的*.sql.zip文件到MySQL过程中遇到上传文件异常: 413 Request Entity Too Large 搜索了一下,原来是
-
11
PHP 技能精进之 PHP-FPM 多进程模型 仅限深圳|现场揭秘:腾讯云原生数据库架构探索与实践 >> ...
-
12
Fastcgi 协议分析与 PHP-FPM 攻击方法 Fastcgi 协议分析与 PHP-FPM 攻击方法 [toc] 前言?没有前言了…… 早期的Web服务器,只能响应浏览...
-
9
php内核分析-fpm和df的问题思考 阅读量 25365...
-
15
配置 php-fpm 并 安装 ionCube7.2 https://www.digitalocean.com...
-
7
解决 Docker Nginx 与 Php-fpm 偶现 502 问题 2021-10-02 这个标题不太好取,目前环境是 Nginx + Php-fpm,其中之前提过 WordPress 容器优化,使用 php -fpm 可以极大程度的减少容器体积,但那时候遗留了一个问题,就是在后台更新插件或...
-
10
PHP-FPM中backlog参数变更的一些思考 浏览:1516次 出处信息 在前年时,业务中遇到好多次因为PHP-FPM的backlog参数...
-
18
Install Nginx With PHP-FPM on Ubuntu 22.04|20.04Search ComputingForGeeksThis guide has been created to help...
-
20
<?xml encoding="utf-8" ??>OpenBSD 7, Nginx, PHP-FPM (FastCGI Process Manager), and MySQL (OEMP) work as a collection to form a web stack that makes it possible to run dynamic applications on a server. Ngi...
-
6
Hardening NGINX and PHP-FPM for Production Arne Blankerts |
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK