1、Apache的安装
上传httpd-2.2.17软件包并解压
[root@localhost ~]# ls
anaconda-ks.cfg httpd-2.2.17.tar.gz
[root@localhost ~]# tar zxvf httpd-2.2.17.tar.gz -C /usr/src
[root@localhost ~]# cd /usr/src/httpd-2.2.17/
yum安装依赖包
[root@localhost ~]# yum -y install pcre-devel apr-devel libdb-devel cyrus-sasl-devel openldap-devel expat-devel apr-util-devel gcc zlib-devel zlib
编译安装开启相应模块
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-cgi --enable-rewrite --enable-so --enable-deflate --enable-expires
[root@localhost httpd-2.2.17]# make && make install
--enable-deflate:启用压缩模块;先压缩网页,在发送给客户端传输速度快
--enable-expires:缓存;有本地缓存使用缓存,没有缓存在从服务器拿数据
软连接
[root@localhost httpd-2.2.17]# ln -s /usr/local/httpd/bin/* /usr/local/bin
[root@localhost httpd-2.2.17]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost httpd-2.2.17]# chmod a+x /etc/init.d/httpd
[root@localhost httpd-2.2.17]# vim /usr/local/httpd/conf/httpd.conf +97
#ServerName www.example.com:80 //删除此行#号
[root@localhost httpd-2.2.17]# /etc/init.d/httpd start
[root@localhost httpd-2.2.17]# netstat -anptu | grep 80
tcp6 0 0 :::80 :::* LISTEN 51199/httpd
验证