Apache・aprのインストール・設定

更新:

Apache・aprのインストール・設定方法。
対象:Linux Fedora, RedHat

Apache・aprのインストール・設定

  • Apacheのサイト
    http://www.apache.org/
  • インストール関連情報
    rpmyum、apt-gettar.gzmake installシェル・環境変数
  • aprのインストール
    apr(Apache Portable Runtime)をインストール。
    ・apr-1.0.0.tar.gz
    	cd /usr/local/src
    	tar xvzf apr-1.0.0.tar.gz
    	./configure
    	make
    	make instal
    
    ・apr-util-1.0.0.tar.gz
    	cd /usr/local/src
    	tar xvzf apr-util-1.0.0.tar.gz
    	./configure --with-apr=/usr/local/apr
    	make
    	make install
    
  • Apacheのインストール
    ・httpd-2.0.52.tar.gz
    	cd /usr/local/src
    	tar xvzf httpd-2.0.52.tar.gz
    	./configure --enable-shared=yes --enable-dav=yes
    	make
    	make install
    		または、./configure --enable-mods-shared=most
    	SSLを使う場合
    		--enable-ssl --with-ssl=/usr/local/ssl
    	mod_rewriteを使う場合
    		--enable-so --enable-rewrite=shared
    	任意のaprを指定する場合(未使用)
    		--with-apr=/usr/local/src/apr-1.0.0 --with-apr-util=/usr/local/src/apr-util-1.0.0
    
    OpenSSLについては、OpenSSLのインストール・設定を参照。
    mod_rewriteについては、mod_rewriteのインストール・設定を参照。
  • 自動起動スクリプト
    起動スクリプトファイルがない場合は自分で作る。
    vi /etc/rc.d/init.d/httpd2
    	#!/bin/sh
    	#
    	# Startup script for the 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/access.conf
    	# config: /usr/local/apache2/conf/httpd.conf
    	# config: /usr/local/apache2/conf/srm.conf
    	# Source function library.
    	. /etc/rc.d/init.d/functions
    	case "$1" in
    	'start')
    		/usr/local/apache2/bin/apachectl start
    		;;
    	'stop')
    		/usr/local/apache2/bin/apachectl stop
    		;;
    	'restart')
    		/usr/local/apache2/bin/apachectl restart
    		;;
    	  *)
    		echo "Usage: $0 {start|stop|restart}"
    		exit 1
    	esac
    	exit 0
    
    パーミッション変更
    chmod 755 /etc/rc.d/init.d/httpd2
  • 自動起動設定・ランレベル
    設定ON
    chkconfig httpd2 on または chkconfig --add httpd2
    設定確認
    chkconfig --list httpd2
  • 起動・終了
    再起動
    /usr/local/apache2/bin/apachectl restart または service httpd2 restart
    起動
    /usr/local/apache2/bin/apachectl start または service httpd2 start
    終了
    /usr/local/apache2/bin/apachectl stop または service httpd2 stop

このエントリーをはてなブックマークに追加