- 安装比较新的版本需要其他新版的依赖关系,
安装之前先安装依赖关系
Apr-1.5.以上版本
Apr-util-1.5以上版本
Pcre-devel
1安装apr:
tar zxvf apr-1.5.4.tar.gz
cd apr-1.5.4
./configure –prefix=/usr/local/apr
Make &make install
2 安装apr-util
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure –prefix=/usr/localapr-util –with-apr=/usr/local/apr
Make&make install
3安装pcre-devel
yum install pcre-devel –y
4安装httpd
Tar zxvf httpd-2.4.4.tar.gz
Cd httpd-2.4.4
./configure - -prefix=usr/local/apache
- -sysconfdir=/etc/httpd/httpd.conf
- -enable-so
- -enable-rewirte
- -enable-cgi
- -enable-cgid
- -enable-modules=most
--enable -mods-shared=most
- -enable-mpms-shared=all
--with-apr=/usr/local/apr
- -with-apr-util=/usr/local/apr-util
Make&make install
编辑配置文件(默认中可能没有 ServerName localhost :80 这一项,需要添加)
Vim /etc/httpd/httpd.conf
添加ServerName localhost :80 ***如果不添加会报错,添加前先关闭服务***
并且添加httpd的pidfile: PidFile “/var/run”
3.在 /etc/init.d/下编写启动脚本 vim/etc/init.d/httpd (脚本名为 httpd)
添加路径: vim /etc/profile.d/httpd.sh
Export PATH=$PATH:/usr/local/apache/bin
之后重新连接就可以了