windows nginx thinkphp nginx伪静态3.2.2 出错求助

ThinkPHP在Nginx服务器下出错的解决方法 - 开源中国社区
当前访客身份:游客 [
当前位置:
这是一个nginx设置的问题,和ThinkPHP无关。ThinkPHP默认使用PATH_INFO来做CURD,而nginx默认设置不处理PATH_INFO,查看nginx可以看到出错日志:
22:05:36 [error] : *3 CreateFile() &E:\company\home\labs\php\thinkphp\server\nginx-0.8.31/..\..\src/Examples/Form/index.php/Index/insert& failed (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: &POST /Examples/Form/index.php/Index/insert HTTP/1.1&, host: &localhost&, referrer: http://localhost/Examples/Form/
说明nginx把PATH_INFO当成了目录文件的一部份,所以找不到该文件。
解决方法一:修改ThinkPHP设置,不使用PATH_INFO
解决方法二:修改nginx设置,支持PATH_INFO
本人使用CoreServer集成包,就以此为例,修改nginx.conf和fastcgi-params
将 &&&&&& location ~ \.php$ { 修改为 &&&&&& location ~ \.php/?.*$ {
将 &&&&&&&& fastcgi_param&& SCRIPT_FILENAME&& $document_root2$fastcgi_script_ 修改为 &&&&&&&& set $fastcgi_script_name2 $fastcgi_script_ &&&&&&&& if ($fastcgi_script_name ~ &^(.+?\.php)(/.+)$&) { &&&&&&&&&&& set $fastcgi_script_name2 $1; &&&&&&&&&&& set $path_info $2; &&&&&&&& } &&&&&&&& fastcgi_param&& PATH_INFO $path_ &&&&&&&& fastcgi_param&& SCRIPT_FILENAME&& $document_root2$fastcgi_script_name2;
将 fastcgi_param&& SCRIPT_NAME&&&&&&& $fastcgi_script_ 修改为 fastcgi_param&& SCRIPT_NAME&&&&&&& $fastcgi_script_name 2;
文章来自:
共有1个评论
<span class="a_vote_num" id="a_vote_num_
更多开发者职位上
有什么技术问题吗?
鉴客的其它问题
类似的话题thinkphp3.2 U方法 nginx下的问题 - ThinkPHP框架
thinkphp3.2 U方法 windows下的访问正常,
nginx下的问题 缺少index.php前面的index
求教,谢谢。
ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。现在位置:

我要回帖

更多关于 thinkphp5 nginx配置 的文章

 

随机推荐