问题描述
我正在尝试设置nginx服务器以在debian中运行php应用程序.我遵循了本教程等.大部分看起来都一样.我最近的配置基于上面的链接.当我尝试运行此php脚本时,
I am trying to set up nginx server to run a php app in debian. I followed this tutorial among others. Most seems the same. My recent configuration is based on the link above. When I try to run this php script,
<?php
phpinfo();
?>
我在浏览器上得到了相同的输出,而不是php info结果.请有人帮我弄清楚哪里出了问题.
I get the same output on the browser instead of php info result. Kindly someone help me figure out where I went wrong.
注意:我的错误日志很干净,仅包含有关Nginx服务器启动的详细信息.
Note: My error logs are clean,contains details on nginx server start only.
谢谢.
推荐答案
您可能要确保 php5-fpm 正在侦听您期望它使用的正确端口.做一个 netstat 清单,看看php-fpm是否在端口9000上监听:
You might want to make sure php5-fpm is listening on the correct port you're expecting it to be using. Do a netstat listing and see if php-fpm is listening on port 9000:
netstat -tulpn
您应该会看到类似以下内容的行:
You should see a line that looks something like this:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2390/php-fpm.conf
如果没有,请检查您的www.conf文件(在/etc/php5/fpm/pool.d/www.conf 中),然后查找"listen = ..." 行,并确保其显示为:
If not, check your www.conf file (in /etc/php5/fpm/pool.d/www.conf) and look for the "listen = ..." line and make sure it says:
listen = 127.0.0.1:9000
我已经看到php5-fpm的默认配置使用套接字而不是tcp端口.
I have seen default configurations of php5-fpm use a socket instead of a tcp port.
这篇关于在Debian机器上使用php5-fpm和nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!