编译安装http-2.4.10
编译安装http-2.4.10:
一、安装开发工具:
# yum groupinstall -y "Development Tools" "Server Platform Development"
lftp 172.16.0.1:/pub/Sources/sources/httpd>
下载这3个包:
mget apr-1.5.0.tar.bz2
apr-util-1.5.3.tar.bz2
httpd-2.4.10.tar.bz2
最好是以上面的顺序进行编译安装:
# tar xf apr-1.5.0.tar.bz2
# cd apr-1.5.0
# ./configure --prefix=/usr/local/apr
# make && make install
# cd
# tar xf apr-util-1.5.3.tar.bz2
# cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
# cd
# tar xf httpd-2.4.10.tar.bz2
# cd httpd-2.4.10
# ./configure --help | less
安装这两个兼容包:
# yum install pcre-devel zlib-devel -y
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-moms-shared=all --with-mom=event
# make && make install
# vim /etc/profile.d/httpd.sh
添加一行: export PATH=/usr/local/apache/bin:$PATH
# . /etc/profile.d/httpd.sh
# apachectl start
# ss -tnl
此时80端口已经被打开;
现在可以通过浏览器访问网站了:172.16.8.101
# ln -sv /usr/local/apache/include /usr/include/httpd
# vim /etc/man.config 把http的man手册添加到主man手册文件中;
添加:MANPATH /usr/local/apache/man
# mkdir /data/web/htdocs -pv
# vim /data/web/htdocs/index.html
添加:<h1>Hello World</h1>
把主配置文件做一下备份(为以后还原做好准备工作):
# cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
# vim /etc/httpd24/httpd.conf
修改为:DocumentRoot "/data/web/htdocs"
<Directory "/data/web/htdocs">
# killall -SIGHUP httpd
此时重新登录浏览器里:输入 172.16.8.101 就可以看到我们刚刚新建的内容了;
增加httpd24的服务脚本:
# cd /etc/rc.d/init.d/
# cp httpd httpd24
# vim httpd24
修改为:
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}
# ll httpd24 查看 是否有执行权限;
# chkconfig --add httpd24
# chkconfig --list httpd24
# chkconfig httpd24 on
# service httpd24 start
# ss -tnl
此时编译安装的http-2.4.10 就可以正常使用了;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。