Apacheの設定Apacheのインストールここまでの段階で、Apache(httpd)本体はインストール済みになっているはず。 もし起動している場合は、一度停止しておく。 # service httpd status ←起動しているかを確認 # service httpd stop ←httpdサーバの停止 念のため、開発ツール関係をインストールしておく。 # yum install httpd-devel apr-devel apr-util-devel pcre-devel Apacheの設定設定ファイルを編集する。 # vi /etc/httpd/conf/httpd.conf 次の箇所を変更する。 ServerTokens Prod ←エラー時にOS名を表示しないようにする
...
KeepAlive On
...
ServerAdmin webmaster@hogehoge.hoge.ac.jp ←エラー時に表示される管理者宛メールアドレス
...
ServerName hogehoge.hoge.ac.jp:80 ←サーバの名前
...
<Directory "/var/www/html">
...
Options Includes ExecCGI FollowSymLinks ←CGIとSSIが使えるようにする
...
AllowOverride All ←.htaccessを許可
...
</Directory>
...
UserDir public_html ←ユーザが~/public_html以下で公開できるようにする
...
<Directory /home/*/public_html>
...
AllowOverride All ←.htaccessを許可
...
Options Includes ExecCGI FollowSymLinks ←CGIとSSIが使えるようにする
...
</Directory>
...
ServerSignature Off ← エラーページでApacheのバージョンを表示しないようにする
...
#AddDefaultCharset UTF-8 ← コメントアウト
...
AddHandler cgi-script .cgi .pl ← CGIスクリプトに.plを追加
設定できたら、設定ファイルの文法をチェックする。 # apachectl configtest あと、余計なページを削除する。 # rm -f /etc/httpd/conf.d/welcome.conf # rm -f /var/www/error/noindex.html また、CGI用に perl にシンボリックリンクを用意する。 # ln -s /usr/bin/perl /usr/local/bin/perl サービスの起動サービスを起動する。 # chkconfig httpd on # service httpd start |