lighttpd 上的 haskell fastCGI,需要配置帮助

发布于 2024-08-16 08:52:28 字数 1494 浏览 1 评论 0原文

我正在尝试设置一个 lighttpd 服务器,它将运行用 haskell 编写的 fastCGI 程序。 到目前为止,我得到了这个 haskell 程序:

import Network.CGI
import Text.XHtml

page :: Html 
page = body << h1 << "Hello World!"

cgiMain :: CGI CGIResult
cgiMain = output $ renderHtml page

main :: IO ()
main = runCGI $ handleErrors cgiMain

以及这个 lighttpd 配置:

server.document-root = "/home/userwww/www/" 

server.port = 80

server.username = "userwww" 
server.groupname = "userwww" 

mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png" 
)

static-file.exclude-extensions = (".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
server.event-handler = "poll"
server.modules              = (
            "mod_access",
            "mod_accesslog",
            "mod_fastcgi",
            "mod_rewrite",
            "mod_cgi",
            "mod_auth"
)


fastcgi.server = ("/test" =>
                   ("test" =>
                     ("socket" => "/tmp/test.sock",
                      "bin-path" => "/home/userwww/www/test.fcgi",
                      "check-local" => "disable"
                     )
                   )
                 )

Lighttpd 启动良好,并且在我打开 index.html 时工作,但是当我尝试打开 http://127.0.0.1/test 它只是开始加载网页并继续无限期地加载它而不显示任何内容。

我怀疑我的 lighttpd.conf 文件是错误的或不完整的,但在查看文档后我找不到它有什么问题。

I'm trying to setup a lighttpd server that will run fastCGI programs written in haskell.
So far i got this haskell program:

import Network.CGI
import Text.XHtml

page :: Html 
page = body << h1 << "Hello World!"

cgiMain :: CGI CGIResult
cgiMain = output $ renderHtml page

main :: IO ()
main = runCGI $ handleErrors cgiMain

and this lighttpd configuration:

server.document-root = "/home/userwww/www/" 

server.port = 80

server.username = "userwww" 
server.groupname = "userwww" 

mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png" 
)

static-file.exclude-extensions = (".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
server.event-handler = "poll"
server.modules              = (
            "mod_access",
            "mod_accesslog",
            "mod_fastcgi",
            "mod_rewrite",
            "mod_cgi",
            "mod_auth"
)


fastcgi.server = ("/test" =>
                   ("test" =>
                     ("socket" => "/tmp/test.sock",
                      "bin-path" => "/home/userwww/www/test.fcgi",
                      "check-local" => "disable"
                     )
                   )
                 )

Lighttpd starts nicely and works when I open index.html but when I try opening http://127.0.0.1/test it just starts loading the web page and continues loading it indefinitely without showing anything.

I suspect my lighttpd.conf file is either wrong or incomplete but after looking at the documentation I can't find whats wrong with it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爺獨霸怡葒院 2024-08-23 08:52:28

我认为你想使用 Network.FastCGI 而不是 Network .CGI。您还必须确保配置 Haskell 程序以在正确的位置查找套接字或侦听正确的端口。

I think you want to use Network.FastCGI instead of Network.CGI. You'll also have to make sure to configure your Haskell program to look in the right place for the socket or listen on the right port.

初心 2024-08-23 08:52:28

在我看来,你的 Haskell 程序就像 CGI 脚本,而不是 fastCGI 脚本。

尝试将其作为 CGI 脚本运行(或者甚至尝试从命令行运行它——它应该输出一些标头,然后在终止之前输出“Hello world”页面)。

Your Haskell program looks to me like a CGI script, not a fastCGI script.

Try running it as a CGI script (or even try running it from the command line --- it should output some headers and then your "Hello world" page before terminating).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文