2010-01-18 25 views
0

我遇到一个令人沮丧的问题,FastCGI的和Rails借此lighttpd的是治疗路由地址的静态文件(即不发送他们导轨因为它认为他们是静态)Lighttpd的/ FastCGI的治疗路径为静态内容

如果我点击根路径,我得到了rails应用程序,但是当我用URL结构打开某些东西时,即使是匹配默认值:controller /:action route的路径,我也从lighttpd获得了404,而rails应用程序isn甚至没有咨询过。

这里是我的lighttpd.conf:

server.modules = ("mod_rewrite", "mod_redirect", "mod_access", "mod_status", "mod_fastcgi", "mod_accesslog") 

server.document-root = "/myapp/application/public" 
index-file.names = ("index.html", "dispatch.fcgi") 
server.error-handler-404 = "/myapp/application/public/404.html" 

url.access-deny = ("~", ".inc") 
server.pid-file = "/var/run/lighttpd.pid" 
server.username = "lighttpd" 
server.groupname = "lighttpd" 

server.errorlog = "/var/log/lighttpd/error.log" 
accesslog.filename = "/var/log/lighttpd/access.log" 

#### fastcgi module 
fastcgi.server = (
    ".fcgi" => (
     "myapp" => (
      "socket" => "/tmp/myapp.socket", 
      "bin-path" => "/myapp/application/public/dispatch.fcgi", 
      "check-local" => "disable", 
      "fix-root-scriptname" => "true", 
      "docroot"=>"/" 
     ) 
    ) 
) 

# mimetype mapping 
mimetype.assign = (...) 

至于错误,我没有得到任何人在所有。 虽然,如果我打开在Lighttpd的调试,我确实看到这样的事件:

2010-01-18 23:11:18: (response.c.261) URI-path  : /tracking/index 
2010-01-18 23:11:18: (response.c.375) -- before doc_root 
2010-01-18 23:11:18: (response.c.376) Doc-Root  : /myapp/application/tracking/public 
2010-01-18 23:11:18: (response.c.377) Rel-Path  : /tracking/index 
2010-01-18 23:11:18: (response.c.378) Path   : 
2010-01-18 23:11:18: (response.c.426) -- after doc_root 
2010-01-18 23:11:18: (response.c.427) Doc-Root  : /myapp/application/tracking/public 
2010-01-18 23:11:18: (response.c.428) Rel-Path  : /tracking/index 
2010-01-18 23:11:18: (response.c.429) Path   : /myapp/application/tracking/public/tracking/index 
2010-01-18 23:11:18: (response.c.446) -- logical -> physical 
2010-01-18 23:11:18: (response.c.447) Doc-Root  : /myapp/application/tracking/public 
2010-01-18 23:11:18: (response.c.448) Rel-Path  : /tracking/index 
2010-01-18 23:11:18: (response.c.449) Path   : /myapp/application/tracking/public/tracking/index 
2010-01-18 23:11:18: (response.c.466) -- handling physical path 
2010-01-18 23:11:18: (response.c.467) Path   : /myapp/application/tracking/public/tracking/index 
2010-01-18 23:11:18: (response.c.523) -- file not found 
2010-01-18 23:11:18: (response.c.524) Path   : /myapp/application/tracking/public/tracking/index 
2010-01-18 23:11:18: (response.c.205) -- splitting Request-URI 
2010-01-18 23:11:18: (response.c.206) Request-URI : /myapp/application/tracking/public/404.html 

任何想法可能是想错了?

回答

0

虽然文档并没有真正解释server.error处理程序设置的重要性,但它仍然存在于facepalm那一刻。

使用fcgi时,您需要确保您的错误处理程序设置为重定向到fcgi分派,否则,它将只显示一个404页面。

server.error-handler-404 = "/dispatch.fcgi" 

现在全部修好了。

+0

请注意,使用“server.error-handler-N”时,将错误页面视为完全限定的请求。他们将代码“200”返回给所有请求。要真正能够通过正确的值返回带有错误代码的页面,您应该使用“server.errorfile-prefix”,在这里声明一个带有错误编号作为文件名称(即“404.html”)的html文件的文件夹。 – user1254893 2012-04-02 11:12:26