cd ../..
mkdir -p /usr/local/apache
./configure \
--prefix=/usr/local/apache \
--enable-mods-shared=all \
--with-mysql=/usr/local/mysql \
--enable-deflate \
--enable-cache \
--enable-file-cache \
--enable-mem-cache \
--enable-disk-cache \
--with-apr=/usr/local/apr/ \
--with-apr-util=/usr/local/apr-util/ \
--enable-rewrite \
--enable-expires \
--enable-authn-dbm \
--enable-vhost-alias \
--with-mpm=worker \
--with-ssl \
--enable-so \
--enable-ssl \
--enable-track-vars \
--with-z \
--disable-ipv6 \
--enable-dav \
make && make install
启动apahce
/usr/local/apache/bin/apachectl -k start
用浏览器查看,得到it works,说明apache已经配置成功了.
停止apache
/usr/local/apache/bin/apachectl -k stop
设为开机自动启动
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd
找到:#!/bin/sh
另起一行,增加下面两行:
#chkconfig:35 85 15
#description: Apache HTTP Server.
chkconfig --add httpd
启动httpd服务
service httpd start
更改网站根目录:
vi /usr/local/apache/conf/httpd.conf
查找:
DocumentRoot "/usr/local/apache/htdocs"
改为:
DocumentRoot "/html"