Apache httpd-2.2.17安装

本文介绍了Apache httpd-2.2.17在CentOS Linux上的安装过程,包括三种工作模式:Prefork、Worker和Event MPM的特性与应用场景。此外,还详细讲解了Apache的优化策略,如保持连接、网页传输压缩、页面缓存时间和隐藏版本号,以提升服务器性能和用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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  

验证 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值