CentOS5.4上に構築する
# yum -y install openssl-devel
$ wget http://ftp.riken.jp/net/apache/httpd/httpd-2.2.14.tar.gz $ tar zxvf httpd-2.2.14.tar.gz
$ cd httpd-2.2.14 $ ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --enable-dav --enable-proxy --enable-proxy-blancer --enable-vhost-alias --with-included-apr --enable-proxy-ajp $ make $ sudo make install
$ cd /usr/local/apache2/conf $ sudo vi httpd.conf
ServerName localhost:80
User appuser ←アプリ用ユーザー
Group appgroup ←アプリ用グループ
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all ←全部拒否
Allow from localhost 192.168.1. ←許可対象を絞る
</Directory>
<Directory "/usr/local/apache2/htdocs">
:
Order deny,allow
Deny from all ←全部拒否
Allow from localhost 192.168.1. ←許可対象を絞る
</Directory>
# Virtual hosts
Include conf/extra/httpd-vhosts.conf ←コメント除去
$ cd /usr/local/apache2/conf/extra/
$ sudo vi httpd-vhosts.conf
### >>>>>既存設定削除
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
#</VirtualHost>
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>
### <<<<<
### >>>>> update
<VirtualHost *:80>
ServerAdmin appuser@web1
DocumentRoot /home/appuser/htdocs
ServerName web1
ErrorLog logs/web1-error_log
CustomLog logs/web1-access_log common
</VirtualHost>
### <<<<<
$ cd /usr/local/apache2/bin $ sudo ./apachectl -k start httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName ←★TODO このWarning何とかする $ sudo ./apachectl -k stop
$ cd <httpdのtar展開ディレクトリ>
$ sudo cp -p build/rpm/httpd.init /etc/init.d/httpd
$ cd /etc/init.d
$ sudo vi httpd
apachectl=/usr/local/apache2/bin/apachectl ←インストール先に変更
httpd=${HTTPD-/usr/local/apache2/bin/httpd} ←インストール先に変更
pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid} ←インストール先に変更
lockfile=${LOCKFILE-/usr/local/apache2/logs/httpd.lock} ←インストール先に変更
:
CONFFILE=/usr/local/apache2/conf/httpd.conf ←インストール先に変更
$ su -
# cd /etc/init.d/
# chown root.root httpd
# chkconfig --add httpd
# service httpd start
# service httpd stop
# chkconfig httpd on