简体   繁体   English

无法使用Perl Dancer的fcgi运行应用

[英]Can not run app using fcgi of perl Dancer

I am testing to deploy the tester example of Dancer using fcgi. 我正在测试使用fcgi部署Dancer的测试器示例。 But it just didn't work. 但这只是没有用。 I keep getting the error message: 我不断收到错误消息:

File does not exist: /home/tester/MyApp/public/dispatch.fcgi/

However, this app can run successfully with cgi. 但是,此应用程序可以与cgi成功运行。 And I have made the changes to http.conf according to dancer's deployment manual. 而且我已经根据舞者的部署手册对http.conf进行了更改。

Can someone pointing me to some solutions or possible reasons for this error? 有人可以为我指出一些解决方案或此错误的可能原因吗?

below is the http.conf: 以下是http.conf:

<VirtualHost *:80>
    ServerName localhost

    # /srv/www.example.com is the root of your
    # dancer application
    DocumentRoot /home/tester/MyApp/public

    ServerAdmin you@example.com

    <Directory "/home/tester/MyApp/public">
       AllowOverride None
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       Order allow,deny
       Allow from all
       AddHandler fastcgi-script .fcgi
    </Directory>

    ScriptAlias / /home/tester/MyApp/public/dispatch.fcgi/

    ErrorLog  /var/log/apache2/MyApp-error.log
    CustomLog /var/log/apache2/MyApp-access_log common
</VirtualHost>

Thank you 谢谢

I don't think that ScriptAlias is what you want to be using. 我不认为ScriptAlias是您要使用的。 From the documentation... 从文档中...

The ScriptAlias directive has the same behavior as the Alias directive, except that in addition it marks the target directory as containing CGI scripts that will be processed by mod_cgi's cgi-script handler. ScriptAlias指令与Alias指令具有相同的行为,不同之处在于,它还将目标目录标记为包含将由mod_cgi的cgi-script处理程序处理的CGI脚本。

Basically Apache looks for a directory called '/home/tester/MyApp/public/dispatch.fcgi/' and every file in this dir is processed through mod_cgi. 基本上,Apache查找一个名为“ /home/tester/MyApp/public/dispatch.fcgi/”的目录,该目录中的每个文件都通过mod_cgi处理。 In this case it can't be found since it's a regular file. 在这种情况下,由于它是常规文件而无法找到。

Have you tried using mod_rewrite ? 您是否尝试过使用mod_rewrite My httpd config for Dancer is pretty much the same as yours except I'm using mod_rewrite 我的Dancer的httpd配置与您的基本相同,只不过我使用的是mod_rewrite

DocumentRoot /home/user/src/MyApp/public
<Directory "/home/user/src/MyApp/public">
  AllowOverride None
  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  Order allow,deny
  Allow from all
  AddHandler fcgid-script .fcgi #using fcgid instead of fastcgi
</Directory>

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dispatch.fcgi$1 [QSA,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM