gpt4 book ai didi

perl - 如何让我的 Poet 网站在 Apache2 下运行?

转载 作者:行者123 更新时间:2023-12-01 22:51:31 38 4
gpt4 key购买 nike

如果我目前有一个 Poet 网站在独立的 plackup 服务器下运行(通过 run.pl),我该如何配置 Apache2 来托管这个 Poet 网站?

搜索“+apache2 +poet”会检索到大量关于诗人使用 Apache2(出版他们的诗歌)的结果,以及“Mason 2 将与 Apache/mod_perl 1 一起工作”等文章。然后就是http://metacpan.org/pod/PSGI::FAQ等文件它告诉我“在 Plack 中,我们已经支持大多数 Web 服务器,例如 Apache2”,但没有提供有关如何提供此类支持的任何细节。

要让我现有的 Poet 网站在 Apache 下运行,我需要的最小 Apache2 配置文件是什么?

这是我现有的项目布局:

/Users/me/Documents/Ponies/poet
bin
run.pl
comps
index.mc
conf
data
db
lib
logs
static
t

这是我的起始 httpd.conf 文件:

LoadModule log_config_module /opt/local/apache2/modules/mod_log_config.so

Listen 5000
ServerRoot /Users/me/Documents/Ponies/poet
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog logs/access.log combined
Errorlog logs/error.log
PidFile httpd.pid
LockFile accept.lock
User me
Group staff

<VirtualHost *:5000>
ServerName foo.local
DocumentRoot /Users/me/Documents/Ponies/poet/
AddHandler cgi-script .cgi .pl .py
<Directory "/Users/me/Documents/Ponies/poet">
Options +ExecCGI
</Directory>
</VirtualHost>

只要有一些指示我需要指向 Poet 网站的哪一部分才能获得诸如 http://foo.local/ponies/ 之类的 URL,我们将不胜感激指向适当文档的链接。生成由 .../Ponies/poet/comps/index.mc 生成的内容。

最佳答案

您可以使用 mod_perl。阅读 mod_perl quick start guide ,然后查看 Plack documentation .请注意,您在 Poet 环境中需要的 key 文件是 bin/app.psgi。结合 PSGI 规范和 Plack 文档研究该文件应该可以帮助您了解正在发生的事情(记住 Plack 只是 PSGI 的一个实现)。

要快速入门,请使用以下 httpd.conf 文件;注意 LoadModule 行和 VirtualHost 内容的替换:

LoadModule log_config_module /opt/local/apache2/modules/mod_log_config.so
LoadModule perl_module /opt/local/apache2/modules/mod_perl.so

Listen 5000
ServerRoot /Users/me/Documents/Ponies/poet
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog logs/access.log combined
Errorlog logs/error.log
PidFile httpd.pid
LockFile accept.lock
User me
Group staff

<VirtualHost *:5000>
ServerName foo.local
DocumentRoot /Users/me/Documents/Ponies/poet/
<Location />
SetHandler perl-script
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app /Users/me/Documents/Ponies/poet/bin/app.psgi
</Location>
</VirtualHost>

当然,这是一个最低限度的配置,它会让你从 plackup 到一个“真正的”网络服务器,在与默认的 Poet 安装相同的端口 5000 上,并且没有考虑诸如安全性、与多个应用程序共享主机或网站管理员、系统管理员或网络安全经理希望您考虑的任何其他细节之类的小事。

关于perl - 如何让我的 Poet 网站在 Apache2 下运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13132042/

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