Nginx 启动以后,无法解析PHP。浏览器里面输出:No input file specified.
我的nginx安装完成以后,启动了php-cgi
/usr/local/nginx/conf# /usr/local/nginx/sbin/spawn-fcgi -f /usr/local/php5/bin/php-cgi -a 127.0.0.1 -p 10005 -u lighttpd -g lighttpd
spawn-fcgi.c.206: child spawned successfully: PID: 19688
ps auxww | grep cgi
lighttpd 19688 0.0 0.2 19096 4636 ? Ss 14:56 0:00 /usr/local/php5/bin/php-cgi
lighttpd 19689 0.0 0.1 19096 2620 ? S 14:56 0:00 /usr/local/php5/bin/php-cgi
lighttpd 19690 0.0 0.1 19096 2620 ? S 14:56 0:00 /usr/local/php5/bin/php-cgi
lighttpd 19691 0.0 0.1 19096 2620 ? S 14:56 0:00 /usr/local/php5/bin/php-cgi
lighttpd 19692 0.0 0.1 19096 2620 ? S 14:56 0:00 /usr/local/php5/bin/php-cgi
lighttpd 19693 0.0 0.1 19096 2620 ? S 14:56 0:00 /usr/local/php5/bin/php-cgi
然后启动nginx:
/usr/local/nginx/sbin/nginx
ps auxww | grep nginx
root 19454 0.0 0.0 3024 640 pts/2 S+ 14:51 0:00 tail -f /usr/local/nginx/logs/error.log
root 20009 0.0 0.0 2812 496 ? Ss 15:03 0:00 nginx: master process /usr/local/nginx/sbin/nginx
lighttpd 20010 0.0 0.0 3352 1280 ? S 15:03 0:00 nginx: worker process
lighttpd 20011 0.0 0.0 2984 912 ? S 15:03 0:00 nginx: worker process
lighttpd 20012 0.0 0.0 2984 912 ? S 15:03 0:00 nginx: worker process
lighttpd 20013 0.0 0.0 2984 912 ? S 15:03 0:00 nginx: worker process
lighttpd 20014 0.0 0.0 2984 912 ? S 15:03 0:00 nginx: worker process
我的nginx.conf如下:
user lighttpd lighttpd;
worker_processes 5;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
include /etc/nginx/fastcgi.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
charset utf-8;
access_log logs/host.access.log main;
location / {
root /home/webroot;
index index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:10005;
}
location ~ /\.ht {
deny all;
}
}
}
然后,我在/home/webroot下建立了一个php文件index.php,
<?php
echo "welcome";
?>
浏览器里面输入:
http://localhost/
浏览器输出:
No input file specified.
有人知道哪个地方错了么?