本地nginx服务器调用虚拟机上的php返回404异常
本地nginx服务器调用虚拟机上的php返回404错误
本地环境: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;
}
}
------解决方案--------------------
我也遇到了同样的问题,请问你是怎么解决的?
------解决方案--------------------
我现在也碰到这个问题了,请问你的fastcgi_param SCRIPT_FILENAME是如何配置的?
我的现在是这样配置的:
fastcgi_param SCRIPT_FILENAME /usr/local/apache/htdocs$fastcgi_script_name;
其中 /usr/local/apache/htdocs 是远程php的根路径。
------解决方案--------------------
同问啊同问啊
------解决方案--------------------
很多是网站根目录路径错误
本地环境: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;
}
}
------解决方案--------------------
我也遇到了同样的问题,请问你是怎么解决的?
------解决方案--------------------
我现在也碰到这个问题了,请问你的fastcgi_param SCRIPT_FILENAME是如何配置的?
我的现在是这样配置的:
fastcgi_param SCRIPT_FILENAME /usr/local/apache/htdocs$fastcgi_script_name;
其中 /usr/local/apache/htdocs 是远程php的根路径。
------解决方案--------------------
同问啊同问啊
------解决方案--------------------
很多是网站根目录路径错误