lighttpd + FastCGI + Mono不能与evhost启用

我已经开始将Windows VPS迁移到linode.com,在nginx和apache上selectlighttpd来托pipe一些build立在asp.net mvc上的网站,而且我坚持认为是“文档根”冲突。

我在Ubuntu 10.04上运行lighttpd 1.4.6,Mono 2.8.2

我已经configurationmod_evhost模式来匹配这个目录结构:

/var/webs/country-tld.tld.domain/www /var/webs/country-tld.tld.domain/subdomain 

并从请求中删除所有的“www”,redirect到url,并且对于静态内容一切工作正常,但是当加载aspx页面时,我总是得到default.aspx的404错误。

当我将server.document-root设置为任何网站(绕过evhost规则)时,Mono工作正常,按预期为aspx页面提供服务。 其中指出我认为,当evhost被启用时,“MONO_FCGI_ROOT”= server.document-root被混合的其余configuration导致aspx内容的404。

有没有人有这样的环境设置经验? 在使用Apache + mod_mono设置所有内容或者为每个主机使用单独的fastcgi映射之前,我真的希望给lighttpd的configuration优雅和简单一个机会。

这些是我的configuration文件。

/etc/lighttpd/lighttpd.conf:

 server.modules = ( "mod_access", "mod_alias", "mod_accesslog", "mod_compress", "mod_rewrite", "mod_redirect", "mod_evhost" ) server.document-root = "/var/webs/default/" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" index-file.names = ( "index.html", "index.htm", "default.htm", "default.html" ) accesslog.filename = "/var/log/lighttpd/access.log" url.access-deny = ( "~", ".inc" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) server.port = 80 server.pid-file = "/var/run/lighttpd.pid" server.dir-listing = "enable" server.username = "www-data" server.groupname = "www-data" #server.error-handler-404 = "/error-handler.html" dir-listing.encoding = "utf-8" compress.cache-dir = "/var/cache/lighttpd/compress/" compress.filetype = ( "text/plain", "text/html", "application/x-javascript", "text/css" ) include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl" ### for global domains with 3 or more letters in last .ext ### and for national domains but -no- second level $HTTP["host"] =~ "^(www.)?([^.]+)\.([az]{2,})$" { evhost.path-pattern = "/var/webs/%1.%2/www/" } $HTTP["host"] =~ "^(www.)?([^.]+)\.([^.]+)\.([az]{2,})$" { evhost.path-pattern = "/var/webs/%1.%2/%3/" } ### for second level national domains with 2 letters in last .ext ### %4 %3 %2 %1 ### sub domain subtld tld $HTTP["host"] =~ "^(www.)?([^.]+)\.([az]{2,3})\.([az]{2})$" { evhost.path-pattern = "/var/webs/%1.%2.%3/www/" } $HTTP["host"] =~ "^(www.)?([^.]+)\.([^.]+)\.([az]{2,3})\.([az]{2})$" { evhost.path-pattern = "/var/webs/%1.%2.%3/%4/" } # redirect "www.domain" to "domain" preserving the parameters $HTTP["host"] =~ "^www\.(.*)$" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) } #### handle Debian Policy Manual, Section 11.5. urls ## by default allow them only from localhost ## (This must come last due to #445459) ## Note: =~ "127.0.0.1" works with ipv6 enabled, whereas == "127.0.0.1" doesn't $HTTP["remoteip"] =~ "127.0.0.1" { alias.url += ( "/doc/" => "/usr/share/doc/", "/images/" => "/usr/share/images/" ) $HTTP["url"] =~ "^/doc/|^/images/" { dir-listing.activate = "enable" } } 

/etc/lighttpd/conf-enabled/10-fastcgi.conf:

 index-file.names += ( "index.aspx", "default.aspx", "Index.aspx", "Default.aspx" ) var.mono_dir = "/opt/mono-2.8.2/" var.mono_shared_dir = "/tmp/" var.mono_fastcgi_server = mono_dir + "bin/" + "fastcgi-mono-server2" var.mono_fcgi_root = server.document-root var.mono_fcgi_applications = "/:." server.modules += ( "mod_fastcgi" ) fastcgi.server = ( ".aspx" => (( "socket" => mono_shared_dir + "fastcgi-mono-server", "bin-path" => mono_fastcgi_server, "bin-environment" => ( "PATH" => "/bin:/usr/bin:" + mono_dir + "bin", "LD_LIBRARY_PATH" => mono_dir + "lib:", "MONO_SHARED_DIR" => mono_shared_dir, "MONO_FCGI_LOGLEVELS" => "Standard", "MONO_FCGI_LOGFILE" => mono_shared_dir + "fastcgi.log", "MONO_FCGI_ROOT" => mono_fcgi_root, "MONO_FCGI_APPLICATIONS" => mono_fcgi_applications ), "max-procs" => 1, "check-local" => "disable" )) ) fastcgi.map-extensions = ( ".asmx" => ".aspx", ".ashx" => ".aspx", ".asax" => ".aspx", ".ascx" => ".aspx", ".soap" => ".aspx", ".rem" => ".aspx", ".axd" => ".aspx", ".cs" => ".aspx", ".config" => ".aspx", ".dll" => ".aspx" )