No.20647 投稿時間:2006年06月07日(Wed) 16:24 投稿者名:ふぁる URL:
いつもお世話になっております。
*前回質問したときとは環境が違っております。
質問:
VirtualHostではなくユーザディレクトリ内でCGIを動作させるのにはどのようにすればよろしいのでしょうか?
状況:
新環境での作業となり、前任者からログインIDなどをきき、設定をしているところのですが
以下の環境でCGIが500InternalServerErrorになります。
下記環境
OS:REDHAT9
WEB:Apache/2.0.40
Perl:v5.8.0
でサーバを構築してあります。
クライアントページなどが数箇所運営されております。
の状況で以下のような現象が起きております。
1.http://hogehoge.com/test.cgi
にアクセスすると期待された結果(画面にOKと出る)が表示されます
2.http:/fugafuga.com/~fuga/test.cgi
にアクセスすると500InternalServerErrorになります
test.cgiは/homo/hoge/public_html/test.cgiで同一のものです。
hogehoge.comはfugafuga.com/~fuga/に割り当てられたVirtualHostです。
httpd.confには
UserDir public_htmlとし
AddHandler cgi-script .cgi、
AddType text/html cgi、
ScriptAliasはコメントアウトとしてあります。
通常ですと上記の設定で~huga/test.cgiは期待通りの動作をすると思うのですが、
エラーとなってしまいまし。
このときのエラーログは
[Wed Jun 07 16:04:22 2006] [error] [client XXX.XXX.XXX.XXX] Premature end of scri
pt headers: test.cgi
となります。
test.cgi
#!/usr/bin/perl --
print "Content-Type: text/html\n\n";
print "ok";
No.20648 投稿時間:2006年06月07日(Wed) 17:28 投稿者名:さにーぶらいあん URL:
これ参考にならない?
[root@fedora ~]# vi /etc/httpd/conf/httpd.conf ← Apache設定ファイル編集
ServerTokens OS
↓
ServerTokens Prod ← エラーページ等でOS名を表示しないようにする
ServerAdmin root@localhost
↓
ServerAdmin webmaster@fedorasrv.com ← エラーページ等に表示される管理者メールアドレスを指定
#ServerName www.example.com:80
↓
ServerName fedorasrv.com:80 ← サーバー名を指定
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
↓
Options Includes ExecCGI FollowSymLinks ← CGI,SSI許可、ファイル一覧表示禁止
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
↓
AllowOverride All ← .htaccessの許可
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
↓
LogFormat "%h %l %u %t \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
← 長すぎるURI(414エラー)はログに記録しない
#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
SetEnvIf Request_URI "default\.ida" no_log ← 追加(wormからのアクセスをログに記録しない)
SetEnvIf Request_URI "cmd\.exe" no_log ← 〃
SetEnvIf Request_URI "root\.exe" no_log ← 〃
SetEnvIf Request_URI "Admin\.dll" no_log ← 〃
SetEnvIf Request_URI "NULL\.IDA" no_log ← 〃
SetEnvIf Remote_Addr 192.168.1 no_log ← 追加(内部からのアクセスをログに記録しない)
CustomLog logs/access_log combined env=!no_log ← 上記以外のアクセスをログに記録する
ServerSignature On
↓
ServerSignature Off ← エラーページ等でApacheのバージョンを表示しないようにする
AddDefaultCharset UTF-8
↓
#AddDefaultCharset UTF-8 ← コメントアウト
#AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi .pl ← CGIスクリプトに.plを追加
[root@fedora ~]# rm -f /etc/httpd/conf.d/welcome.conf ← テストページ削除
[root@fedora ~]# rm -f /var/www/error/noindex.html ← テストページ削除
Options Includes ExecCGI FollowSymLinks
これは変更しましたか???
No.20649 投稿時間:2006年06月07日(Wed) 18:03 投稿者名:ふぁる URL:
ご回答ありがとうございます。
> これ参考にならない?
-----snip----
>
> Options Includes ExecCGI FollowSymLinks
> これは変更しましたか???
Optionsですが、
ALL、ExecCGIなど試しましたがエラーになるだけです。説明不足申し訳ございません。
No.20650 投稿時間:2006年06月07日(Wed) 18:13 投稿者名:wal URL:
> ご回答ありがとうございます。
> > これ参考にならない?
> -----snip----
> > > > Options Includes ExecCGI FollowSymLinks
> > これは変更しましたか???
> > Optionsですが、
> ALL、ExecCGIなど試しましたがエラーになるだけです。説明不足申し訳ございません。
/home/hogeのパーミッションは?
redhatだと700になっていませんか
httpdのユーザ apacheが読みにいけないのでは?
suexecの問題はありませんか
No.20651 投稿時間:2006年06月07日(Wed) 18:57 投稿者名:ふぁる URL:
ご回答ありがとうございます。
結論から言うとsuEXECでございました。
強引ではありますがsuExecを使わないようにしました。
> /home/hogeのパーミッションは?
> redhatだと700になっていませんか
> httpdのユーザ apacheが読みにいけないのでは?
> suexecの問題はありませんか