解决php-fpm启动之后没有9000端口的问题
文章发布较早,内容可能过时,阅读注意甄别。
想要在 lnmp 环境下配置一个禅道服务呢,但是却发现php-fpm端口
没出现。
那么在 nginx 配置处想要调用的时候就会报错。
最后在网上看到一篇解疑,解决了这个问题。传送 (opens new window)
netstat -tpln
未发现监听9000
端口。查看/var/log/php5-fpm.log
一切正常。
随后查看 PHP 配置文件:/usr/local/php/etc/php-fpm.conf
(源码安装)。
发现listen = /tmp/php-cgi.sock
。
想要解决 nginx 调用的问题,可参考如下办法。
修改 nginx 下的sites
配置:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param APPLICATION_ENV production;
include fastcgi_params;
}
1
2
3
4
5
6
2
3
4
5
6
为
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
1
2
3
4
5
6
2
3
4
5
6
重启 php-fpm 与 nginx 后,服务即可正常访问。
![微信](https://t.eryajf.net/imgs/2023/01/834f12107ebc432a.png)
![支付宝](https://t.eryajf.net/imgs/2023/01/fc21022aadd292ca.png)
上次更新: 2024/07/04, 22:40:37
- 01
- 学习周刊-总第169期-2024年第30周07-26
- 02
- 使用docker快速部署rancher-2.8.5并投入生产实践07-20
- 03
- 学习周刊-总第168期-2024年第29周07-18