Lighttpd+FastCGi发布Django站点遇到的奇怪问题

握瑜 2011-06-10 05:50:42
我算是一个django新手,最近接受维护一个django站点,前面的人基本上搞完了,只是发布这块弄的不尽人意,所以我现在主要就是弄这块内容,当然有问题的地方还是要改的。
手上这个django站点采用lighttpd作为服务器结合fastcgi来运行,刚开始的时候还没注意这个问题,今天研究lighttpd发布多站点的时候无意间将lighttpd.conf中的server.document-root项改成了一个无关紧要的地址,然后重启lighttpd和fcgi,启动FCGI的脚本
exec /usr/bin/env -  python ./manage.py runfcgi host=127.0.0.1 port=3333  pidfile=$PIDFILE method=prefork  minspare=40 maxspare=60

我当时也就是在一个站点目录下运行上述启动fcgi脚本的 ,在浏览器中竟然就可以访问该站点了,但是在lighttpd.conf 中并没有把server.document-root指向该站点目录呀,感觉非常奇怪。
不知道大家是否遇到过这样的问题。不知道是不是启动fcgi的shell脚本上的问题,望高手指点。
...全文
116 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
握瑜 2011-06-13
  • 打赏
  • 举报
回复
好吧,我自己来说一个出现上述情况的原因:

主要是在fastcgi.server中将check-local项设置成了disable,这样就不会检查server.document-root,看原文

"check-local": is optional and may be "enable" (default) or "disable". If enabled the server first checks for a file in local 'server.document-root' tree and returns 404 (Not Found) if no such file, and does not fall back to FastCGI. If disabled, the server forwards a request to the FastCGI interface without this check.
握瑜 2011-06-11
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 kamchihau 的回复:]

这个我估计:它的设计可能是,
如果在程序比如DJANGO中设定,就用程序中的设定,
如果在程序及SERVER中都设定,都用程序中的,
如果只有SERVER设定,就用SERVER的,

不知到它的文档有没有说到这一点,又或是开发者当卖生菜,
连写都懒得写吧,楼主可以到网上搜搜看
[/Quote]

我也有看了下lighttpd的配置文档,不过也只是找对应点看的,没有把所有相关的配置看完,下面这段是原文:
Lighttpd needs a configuration file called lighttpd.conf—in
fact it will not run without one. To make it as simple as possible, we start with the
absolute minimum:
server.document-root = "/var/www"

mimetype.assign = ("" => "text/html")

Yes, that is all. Of course you should take the path to your website as your document
root. Under UNIX, /var/www is a probable path, while Windows users may want to
put their site in a place like C:\www\mysite. The mimetype.assign statement simply
says that everything is to be served as if it were an HTML page.

其实主要文档是英文的,自己的英文也不是很好,可能理解上有点偏差,这个文档感觉说的还挺详细的,就是没涉及到我想要的说明。
KAMCHIHAU 2011-06-10
  • 打赏
  • 举报
回复
这个我估计:它的设计可能是,
如果在程序比如DJANGO中设定,就用程序中的设定,
如果在程序及SERVER中都设定,都用程序中的,
如果只有SERVER设定,就用SERVER的,

不知到它的文档有没有说到这一点,又或是开发者当卖生菜,
连写都懒得写吧,楼主可以到网上搜搜看

2,204

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 CGI
社区管理员
  • CGI社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧