1
nonozone 2013 年 11 月 18 日
应该是这样
|
2
alexrezit 2013 年 11 月 18 日 via iPhone
RTFM.
|
4
Lax 2013 年 11 月 18 日
nginx不内置php解析。再看看php-fpm。
|
5
coolicer OP server {
listen 8080 default_server; listen [::]:80 default_server ipv6only=on; root /home/httpd; index index.html index.htm; server_name localhost; location ~ \.php$ { root /home/httpd; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } |
7
AstroProfundis 2013 年 11 月 18 日
你9000端口上有php-fcgi进程么?用httpd的话应该把端口改掉,比如默认的80改成81,然后nginx里面 proxy_pass http://127.0.0.1:81;
如果是装了 php5-fpm 然后启动就是 fastcgi_pass 127.0.0.1:9000; |
8
coolicer OP @AstroProfundis 没有9000进程,我是用源安装php和Nginx
|
9
F0ur 2013 年 11 月 18 日
php-fpm没开启吧。。
|
10
AstroProfundis 2013 年 11 月 18 日
@coolicer 那你显然要启动了后端才行啊...不过配置正确的话后端没启动应该是502错误,你试试改成 proxy_pass 到你的php-cgi端口
|
11
jtn007 2013 年 11 月 18 日
我跑rails,nginx是用passenger装的。。。
|
12
barbery 2013 年 11 月 18 日
ubuntu 上还要 sudo apt-get install php5-fpm
|
13
sandtears 2013 年 11 月 18 日
需要用fastcgi_pass转发给php5-fpm吧
|
14
hfcorriez 2013 年 11 月 19 日
看了你的解决方案,是你fpm配置监听方式的问题。
fpm分为端口监听和unix socket监听方式,前者对应你的IP端口,后者对应文件路径,nginx配置一致才能解决问题! |
15
msg7086 2013 年 11 月 19 日
包管理默认的PHP-FPM的配置在 /etc/php5/fpm/pool.d/www.conf 里面可以改监听方式。
只要nginx和www.conf两者的设定相同就不会出问题 |