gpt4 book ai didi

perl - 使用独立的 Perl FastCGI/FCGI Web 服务器在 Perl 中测试 FastCGI 脚本

转载 作者:行者123 更新时间:2023-11-28 20:07:05 25 4
gpt4 key购买 nike

我有一个 FastCGI Perl 网络应用程序(使用 CGI::Fast 编写,但这应该无关紧要),我想在FastCGI 模式下进行测试。

我可以使用什么 Perl 模块来运行 FastCGI 应用程序(该模块应该从 CPAN 安装,最好不要使用额外的库),这样我就可以指向 Web 浏览器,例如到 http://localhost:5000 检查它是否正常工作?

更好的是,是否有一些 Test::* 模块允许自动测试 FastCGI 应用程序,如 FastCGI 应用程序?


添加于 06-07-2010:
看起来 Perl 中没有独立的 FastCGI 服务器;或者至少我没有找到。我在 CPAN 上找到的 FCGI/FastCGI 相关模块是关于编写 FastCGI 应用程序,或者连接到现有的 FastCGI 服务器。

最佳答案

我不知道有什么模块可以让您专门测试 Fast CGI 应用程序。为了在开发时运行快速 CGI 脚本进行测试,我通常会像这样设置一个小型 lighttpd 服务器:

$HTTP["url"] =~ "^/[^/]*$" {
fastcgi.server = (
"/" => ((
"socket" => "/tmp/myapp.sock",
"bin-path" => "/path/to/my/fastcgi/script.pl",
"check-local" => "disable",
"allow-x-send-file" => "enable",
)),
)
}

# Use this if you also want to serve static files directly (not through your CGI app).
$HTTP["url"] =~ "^/static/.*$" {
url.rewrite-once = ( "^/static/\(.*\)$" => "static/$1" )
}

您可能还想将端口设置为 5000 或任何高于 1024 的端口,以便您可以以用户身份运行它。将文件保存在您的项目目录中并像这样运行 lighttpd:

/usr/sbin/lighttpd -f lighttpd.conf -D

关于perl - 使用独立的 Perl FastCGI/FCGI Web 服务器在 Perl 中测试 FastCGI 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2988217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com