发表时间:2012-11-05
最后修改:2012-11-05
(对不起,发错地方了 没有找到删帖的地方)
本地环境:windows + nginx 1.2.4U
虚拟机:ubuntu(192.168.118.133)+php5.3.10
想用本地的nginx通过fastcgi的方式调用远程的php对php脚本进行解析
html可以正常显示,php脚本返回404错误
错误日志:
2012/11/04 12:14:03 [error] 2684#1876: *73 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /a.php HTTP/1.1", upstream: "fastcgi://192.168.118.133:9000", host: "www.test.cc:8000"
nginx配置
server {
listen 8000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root D:\webserver\nginx-1.2.4\html;
fastcgi_pass 192.168.118.133:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME D:\webserver\nginx-1.2.4\html$fastcgi_script_name;
include fastcgi_params;
}
}
php-fpm配置
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
[www]
user = www-data
group = www-data
listen = 9000
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
chdir = /