启用FastCGI应用程序2时,Apache停止提供静态页面
我正在尝试在Apache 2.4下以FastCGI脚本的形式运行Dancer2,如下所述: My/etc/apache2/sites enabled/saltstrau.men.conf如下所示:启用FastCGI应用程序2时,Apache停止提供静态页面,apache,perl,Apache,Perl,我正在尝试在Apache 2.4下以FastCGI脚本的形式运行Dancer2,如下所述: My/etc/apache2/sites enabled/saltstrau.men.conf如下所示: <VirtualHost *:80> ServerName saltstrau.men DocumentRoot /var/www/me/MyApp/public FcgidWrapper /var/www/me/MyApp/public/dispatch.f
<VirtualHost *:80>
ServerName saltstrau.men
DocumentRoot /var/www/me/MyApp/public
FcgidWrapper /var/www/me/MyApp/public/dispatch.fcgi
<Directory "/var/www/me/MyApp/public">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AddHandler fastcgi-script .fcgi
Require all granted
Header set Access-Control-Allow-Origin "*"
</Directory>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /dispatch.fcgi$1 [QSA,L]
CustomLog /var/log/apache2/saltstrau.men_access.log combined
ErrorLog /var/log/apache2/saltstrau.men_error.log
</VirtualHost>
$ dancer2 gen -a MyApp
但当我把笔记本电脑的浏览器指向
我看到的不是“Perl正在跳舞”页面,而是一个网页,上面写着:
Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at saltstrau.men Port 80
请注意,这不是Dancer2的静态…/MyApp/public/404.html页面
问题:如何使Dancer2在Apache 2.4的端口80上工作
解决此问题的一些失败尝试:
/etc/apache2/mods-enabled$ ls
access_compat.load autoindex.load include.load setenvif.conf
alias.conf deflate.conf mime.conf setenvif.load
alias.load deflate.load mime.load socache_shmcb.load
auth_basic.load dir.conf mpm_event.conf ssl.conf
authn_core.load dir.load mpm_event.load ssl.load
authn_file.load env.load negotiation.conf status.conf
authz_core.load fcgid.conf negotiation.load status.load
authz_host.load fcgid.load reqtimeout.conf
authz_user.load filter.load reqtimeout.load
autoindex.conf headers.load rewrite.load
我最初认为我已经通过改变来解决这个问题
AddHandler fastcgi-script .fcgi
到
在my/etc/apache2/sites enabled/saltstrau.men.conf中
,如Apache文档的“配置指令”示例所示:
然而,这个“解决方案”并没有持续很久,所以我放弃了启动Dancer2作为一个快速CGI应用程序
解决方案:我最终启动了Dancer2作为一个独立的守护进程,并在Apache配置中使用ProxyPass将请求转发给Dancer2。正如上述评论所建议的那样。这已经可靠地工作了好几天了 您已将Apache配置为运行FCGI,但您正在将应用程序作为单独的守护进程运行。您应该将Apache配置为代理到您的守护进程,如中所述。他的意思是,您正在作为HTTP守护进程运行。(@Grinnz的说法令人困惑,因为FCGI应用程序必须作为守护程序运行。)我意识到,在我的问题中提到plackup给人的印象是,我试图独立运行webapp。我现在更新了我的问题,以反映我正试图在Apache下以FastCGI脚本的形式运行Dancer2。我还调整了标题。
$ sudo plackup -p 80 /var/www/me/MyApp/bin/app.psgi
failed to listen to port 80: Address already in use at
/usr/local/share/perl/5.26.1/HTTP/Server/PSGI.pm line 103.
/etc/apache2/mods-enabled$ ls
access_compat.load autoindex.load include.load setenvif.conf
alias.conf deflate.conf mime.conf setenvif.load
alias.load deflate.load mime.load socache_shmcb.load
auth_basic.load dir.conf mpm_event.conf ssl.conf
authn_core.load dir.load mpm_event.load ssl.load
authn_file.load env.load negotiation.conf status.conf
authz_core.load fcgid.conf negotiation.load status.load
authz_host.load fcgid.load reqtimeout.conf
authz_user.load filter.load reqtimeout.load
autoindex.conf headers.load rewrite.load
AddHandler fastcgi-script .fcgi
SetHandler fcgid-script