apache2のインストール手順についての解説
- 展開~コンパイル
# tar xvfz httpd-2.***.***.****.tar.gz
# cd httpd-2.***.***.****
# ./configure --with-mpm=worker --enable-module=so --enable-shared=yes
--enable-dav=yes
※webdav機能を有効 --enable-dav=yes
# make
# make install
- 自動起動設定
# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
# chmod 700 /etc/init.d/httpd
# /etc/init.d/httpdファイルに
#!/bin/sh
#
# chkconfig: 35 85 15 ※この行を追加する
# description: apache 2.2.9 ※CentOS5.1にhttpd-2.2.9をインストールした場合はこの行が必要
- # chkconfig --levle 2345 httpd on
# chkconfig --add httpd
- httpdの設定
修正前設定ファイルの退避
# cd /usr/local/apache2/conf/
# cp httpd.conf httpd.conf-default
設定ファイル修正
# vi httpd.conf ※最低、以下の二箇所(赤字下線部)を修正
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g.admin@your-domain.com
#
ServerAdminyou@example.com ← この行を修正する
#
# ServerName gives the name and port that the server uses to identify
itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address
here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerNamewww.example.com:80 ← この行を修正する
- その他コマンド
■設定修正後の構文チェック
# /usr/local/apache2/bin/apachectl configtest
■サービスの停止
# /usr/local/apache2/bin/apachectl stop
■ サービスの起動
# /usr/local/apache2/bin/apachectl start
■サービスの再起動
# /usr/local/apache2/bin/apachectl restart