Top > Install Log > CentOS5 > http
AND OR

Apacheの設定

CentOS(RHELも)では、Apacheのパッケージ名は「http」になっていることに注意。 ちなみにバージョンは、Apache2になっている。

Apacheのインストール

ここまでの段階で、サーバ本体はインストール済みになっている。

httpd.i386                               2.2.3-11.el5_1.centos. installed
httpd-manual.i386                        2.2.3-11.el5_1.centos. installed
apr.i386                                 1.2.7-11               installed
apr-util.i386                            1.2.7-6                installed

開発ツール関係をインストールしておく。

# yum install httpd-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

参考


リロード   差分   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: Tue, 11 Mar 2014 20:20:22 JST (3692d)