我正在尝试从我的浏览器运行一个简单的 fcgi 程序(用于测试目的)。
我从这里获取了代码:(fcgi not cgi) Run a C Program on a Linux Server
我在 HTTP 标头的末尾用 \n\r\n\r 替换了 \n\n。
我还确保 http.conf 具有以下 VirtualHost:
<VirtualHost [snip]>
SuexecUserGroup "#502" "#502"
ServerName [snip]
ServerAlias [snip]
ServerAlias [snip]
ServerAlias [snip]
DocumentRoot /[snip]/public_html
ErrorLog /var/log/virtualmin/[snip].com_error_log
CustomLog /var/log/virtualmin/[snip].com_access_log combined
ScriptAlias /cgi-bin/ /[snip]/[snip].com/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /[snip]/[snip].com/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
AddHandler fcgid-script .fcgi
FCGIWrapper /[snip]/fcgi-bin/php5.fcgi .php
FCGIWrapper /[snip]/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /[snip]/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.[snip].com
RewriteRule ^(.*) https://[snip]:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.[snip]
RewriteRule ^(.*) http://[snip]:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
</VirtualHost>
我只为 fcgi 文件添加了处理程序行,其余的由 Virtualmin 在创建子域时生成。
我一直在寻找过去的 2 小时并进行了一些实验,但没有任何好的结果。我总是收到 500 内部服务器错误。
错误日志:
[Mon Feb 03 18:16:39 2014] [warn] [client SNIP] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Feb 03 18:16:39 2014] [error] [client SNIP] Premature end of script headers: pibell_server.fcgi
非常感谢。