TITLE:Apacheの設定 *Apacheの設定 [#n9e6f857] CentOS(RHELも)では、Apacheのパッケージ名は「http」になっていることに注意。 ちなみにバージョンは、Apache2になっている。 **Apacheのインストール [#z341e6a3] ここまでの段階で、サーバ本体はインストール済みになっている。 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の設定 [#he0cac1a] 設定ファイルを編集する。 # 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 **サービスの起動 [#rb7e6976] サービスを起動する。 # chkconfig httpd on # service httpd start ***参考 [#oec101e2] -http://centossrv.com/ -http://www.server-world.info/note?os=ce5&p=web&f=1 |