1

在我新的 Ubuntu 8.04 上

我安装了虚拟机。然后我像在其他服务器(Debian)上一样设置了 fastcgi。但是我有一个小问题。当我打开网站而不是运行 fastcgi 包装器时,它会下载它。这是配置:

<IfModule mod_fastcgi.c>
    FastCgiIpcDir /usr/lib/apache2/fastcgi
    AddHandler fastcgi-script .fcgi
    FastCgiWrapper /usr/local/sbin/suexec
    FastCgiConfig -singleThreshold 1 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION
</IfModule>

网站.conf:

   SuexecUserGroup "#1002" "#1003"  
   DocumentRoot /home/przepisy/public_html  
   ScriptAlias /php-fastcgi/ /home/przepisy/php-fastcgi/  
   AddHandler php-fastcgi .php  
   AddType application/x-httpd-php .php  
   Action php-fastcgi /php-fastcgi/php5-fcgi  
   DirectoryIndex index.html index.php  
   <Directory /home/przepisy/public_html>  
    Options -Indexes +ExecCGI FollowSymLinks  
    allow from all  
    AllowOverride All  
   </Directory>  

/home/przepisy/php-fastcgi/php5-fcgi

#!/bin/sh 
PHPRC="/home/przepisy/conf/" 
export PHPRC 
PHP_FCGI_CHILDREN=4 
export PHP_FCGI_CHILDREN 
PHP_FCGI_MAX_REQUESTS=200 
export PHP_FCGI_MAX_REQUESTS 
exec /usr/bin/php5-cgi 

因此,如果我访问网站,它会给它一个随机名称,当我查看下载的内容时,它会显示 php5-fcgi 内容。当我指定 php 脚本(例如 index.php)时,它会选择保存并显示 php5-fcgi 的内容......我不知道在这个阶段。这个配置在 Debian 上运行没问题...

4

1 回答 1

3

您需要添加一个部分,告诉 Apache 使用 mod_fastcgi 使用 FastCGI 执行您的 php5-fcgi 脚本。尝试将其添加到您的 website.conf 中:

<Location "/php-fastcgi/php5-fcgi">
   Order Deny,Allow
   Deny from All
   Allow from env=REDIRECT_STATUS
   Options ExecCGI
   SetHandler fastcgi-script      
</Location>

SetHandler fastcgi-script部分告诉 Apache 在执行 php5-fcgi 脚本时使用 mod_fastcgi。Allow from env=REDIRECT_STATUS阻止访问者通过访问http://mydomain.com/php-fastcgi/php5-fcgi.

另外,我用

FastCgiWrapper On

而不是您在示例中列出的 suexec 二进制文件。我的 Apache 是在 SuEXEC 支持下编译的,我SuexecUserGroup和你一样使用。我的 SuEXEC 使用这种配置 - 可能值得一试。

当然,我确定您已经检查过,但请确保您有:

LoadModule fastcgi_module modules/mod_fastcgi.so

在您的 Apache 配置中的某个位置。

于 2009-07-13T15:08:32.153 回答