apache fastcgi 不起作用 - 包装器下载未运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1118602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
fastcgi does not work - wrapper dowloaded not run
提问by Engrost
On my fresh Ubuntu 8.04
在我新的 Ubuntu 8.04 上
I installed virtualmin. Then I set up fastcgi as I did on my other server (Debian). Bu I have small problem. When I open website It instead of running fastcgi wrapper it downloads it. Here is config:
我安装了virtualmin。然后我像在其他服务器(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
/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
So If I access website it gives it random name and when I look at downloaded contents it shows php5-fcgi contents. When I specify php script eg index.php it opts to save and shows contents of php5-fcgi... I'm dunno at this stage. This config worked on Debian no problems...
所以如果我访问网站,它会给它随机名称,当我查看下载的内容时,它会显示 php5-fcgi 内容。当我指定 php 脚本,例如 index.php 时,它选择保存并显示 php5-fcgi 的内容...我不知道在这个阶段。这个配置在 Debian 上运行没有问题......
回答by blt04
You need to add a section that tells Apache to use mod_fastcgi to execute your php5-fcgi script using FastCGI. Try adding this to your website.conf:
您需要添加一个部分,告诉 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>
The SetHandler fastcgi-scriptpart tells Apache to use mod_fastcgi when executing your php5-fcgi script. The Allow from env=REDIRECT_STATUSprevents visitors from downloading your php5-fcgi script directly by accessing http://mydomain.com/php-fastcgi/php5-fcgi.
该SetHandler fastcgi-script部分告诉 Apache 在执行 php5-fcgi 脚本时使用 mod_fastcgi。在Allow from env=REDIRECT_STATUS通过直接访问您下载的php5-fcgi的脚本防止游客http://mydomain.com/php-fastcgi/php5-fcgi。
Also, I use
另外,我用
FastCgiWrapper On
instead of the suexec binary you listed in your example. My Apache is compiled with SuEXEC support and I use SuexecUserGroupas you do. My SuEXEC works with this configuration - might be worth trying.
而不是您在示例中列出的 suexec 二进制文件。我的 Apache 是用 SuEXEC 支持编译的,我SuexecUserGroup和你一样使用。我的 SuEXEC 使用此配置 - 可能值得一试。
And of course I'm sure you've already checked, but make sure you have:
当然,我确定您已经检查过,但请确保您已:
LoadModule fastcgi_module modules/mod_fastcgi.so
somewhere in your Apache configuration.
在您的 Apache 配置中的某处。

