ブラウザから単純な fcgi プログラムを (テスト目的で) 実行しようとしています。
ここからコードを取得しました:(cgiではなくfcgi) LinuxサーバーでCプログラムを実行する
HTTP ヘッダーの末尾にある \n\n を \n\r\n\r に置き換えました。
また、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
どうもありがとうございました。