1.下载三个压缩包
wget http://archive.apache.org/dist/httpd/httpd-2.4.4.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
2.安装依赖
yum -y install gcc autoconf automake make \
> pcre pcre-devel openssl openssl-devel
3. 解压这三个压缩包到目录
tar -zxf httpd-2.4.4.tar.gz -C /usr/src
tar -zxf apr-1.4.6.tar.gz -C /usr/src
tar -zxf apr-util-1.5.2.tar.gz -C /usr/src
4.分别安装
(1)
cd /usr/src/apr-1.4.6/
./configure
make && make install
(2)
cd /usr/src/apr-util-1.5.2/
./configure --with-apr=/usr/local/apr/
make && make install
(3)
cd /usr/src/httpd-2.4.4/
./configure --prefix=/usr/local/apache2 --enable-so \
> --enable-ssl --enable-rewrite --with-mpm=worker --with-suexec-bin \
> --with-apr=/usr/local/apr
make && make install
5.配置httpd.conf
打开配置文件
vim /usr/local/apache2/conf/httpd.conf
添加一句:
ServerName localhost:80
6.启动apache
/usr/local/apache2/bin/apachectl start
7.浏览器访问服务器ip,出现It works!启动成功