ファイルをダウンロードして,展開後にApacheのインストールを開始します。
wget http://ftp.riken.jp/net/apache/httpd/httpd-2.2.6.tar.gz
tar zxvf httpd-2.2.6.tar.gz
-----------① Apach Configuration -------------
./configure \
--enable-rewrite \
--enable-so \
--enable-ssl \
--enable-dav \
--enable-dav-fs \
--enable-suexec \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-webdav=true \
--with-suexec-docroot=/home/www \
--with-included-apr \
--with-apxs=/usr/local/apache2/bin/apxs \
--with-suexec-caller=apache
※WEBDAVはサブバージョン用に準備したもの。
※Cache関連のオプションは,apache2.xxで可能。
-----------② Apach Compile -------------------
make
-----------③ Install -------------------------
make install
-----------④ 起動スクリプト準備 /etc/init.d/ -
#!/bin/bash
#
# Startup script for Apache Web Server
# chkconfig: 345 85 15
#
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin:/bin
CMDPATH=/usr/local/apache2/bin/
CMD=apachectl
test -f $CMDPATH$CMD || exit 0
start()
{
echo -n "Starting httpd ... "
$CMDPATH$CMD start
echo "done."
}
stop()
{
echo -n "Stopping httpd ... "
$CMDPATH$CMD stop
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
sleep 2
start
;;
*)
echo "Usage: /etc/rc.d/init.d/rc.httpd2 {start|stop|restart}"
exit 1
;;
esac
exit 0
-----------⑤ 起動確認 -------------------------
[root@localhost apache2]# /etc/init.d/http start
Starting httpd ... done.
-----------⑥ 自動起動設定 ---------------------
[root@localhost apache2]# chkconfig --list http2
[root@localhost apache2]# chkconfig --add http2
[root@localhost apache2]# chkconfig --list http2
http2 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@localhost apache2]#
-----------⑦ httpd.confの編集------------------
ServerSignature Off
ServerTokens ProductOnly
HostnameLookups Off
TraceEnable Off
-----------⑧ httpd.confの確認------------------
[root@localhost bin]# ./apachectl -t
Syntax OK
とりあえず基本設定完了