nginx FastCGI错误Primary script unknown解决办法
更新时间:2014年03月10日 16:40:55 作者:
这篇文章主要介绍了nginx错误Primary script unknown解决办法,需要的朋友可以参考下
在centos上成功编译安装nginx 1.4、php 5.4并成功启动nginx和php-fpm后,访问php提示"File not found.",同时在错误日志中看到:
复制代码 代码如下:
2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.168.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.168.133"
错误解决方法:
在Nginx配置文件中找到定义调用脚本文件的地方,如:
复制代码 代码如下:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
修改成如下方式($document_root):
复制代码 代码如下:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
提示:
$document_root 代表当前请求在root指令中指定的值。如:
复制代码 代码如下:
location / {
root /usr/local/nginx/html;
index index.php index.html index.htm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
root /usr/local/nginx/html;
index index.php index.html index.htm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
上面配置中的$document_root就是针对/usr/local/nginx/html目录下的php文件进行解析。
您可能感兴趣的文章:
- Windows下Nginx+PHP5的安装与配置方法
- Nginx下301重定向域名的方法小结
- CentOS+Nginx+PHP+MySQL详细配置(图解)
- nginx 多站点配置方法集合
- NGINX下配置404错误页面的方法分享
- nginx提示:500 Internal Server Error错误的解决方法
- Nginx 403 forbidden的解决办法
- Nginx伪静态配置和常用Rewrite伪静态规则集锦
- nginx日志配置指令详解
- Nginx作为反向代理时传递客户端IP的设置方法
- 权限问题导致Nginx 403 Forbidden错误的解决方法
- 完美解決Nginx 504 Gateway time-out问题
- 详解Nginx服务器中配置超时时间的方法
- Nginx服务器的反向代理proxy_pass配置方法讲解
- Nginx服务器中配置非80端口的端口转发方法详解
- Nginx的超时timeout配置详解
- 详解nginx upstream 配置和作用
- nginx从安装到配置详细说明(安装,安全配置,防盗链,动静分离,配置 HTTPS,性能优化)
相关文章
nginx提示:500 Internal Server Error错误的解决方法
本文章来给大家总结了大量关于导致nginx中提示500 Internal Server Error错误的原因总结与解决方法分析有需要了解的朋友可参考参考2013-04-04解读nginx反向代理location和proxy_pass的映射关系
这篇文章主要介绍了解读nginx反向代理location和proxy_pass的映射关系,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教2024-01-01Windows下使用Nginx+Tomcat做负载均衡的完整步骤
这篇文章主要介绍了Windows下使用Nginx+Tomcat做负载均衡的完整步骤,帮助大家搭建负载均衡集群,感兴趣的朋友可以了解下2020-09-09
最新评论