首页 > 系统 > Ubuntu > 正文

ubuntu16.04 linux 编译安装apache2.4.33的教程详解

2020-10-28 18:42:54
字体:
来源:转载
供稿:网友

下载软件包:

wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.33.tar.gzwget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gzwget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

首先需要安装apr和apr-util

tar xf apr-1.6.3.tar.gz cd apr-1.6.3/./configuresudo makesudo make install

安装apr-util:

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprsudo makesudo make install

这两个必不可少,如果缺少其他的依赖,请自行百度

安装apr-util的,在编译的时候报错:

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

解决方法:

sudo apt-get install libexpat1-dev

还有其他依赖:

1,pcre

sudo apt-get install libpcre3 libpcre3-dev 

2,openssl

sudo apt-get install openssl libssl-dev 

3,zlib

sudo apt-get install zlib1g-dev

编译apache

./configure /--prefix=/usr/local/httpd24 /--sysconfdir=/etc/httpd24 /--enable-so /--enable-ssl /--enable-cgi /--enable-rewrite /--with-zlib /--with-pcre /--with-mpm=prefork /--enable-modules=most /--enable-mpms-shared=all 

最后make makeinstall

root@dev:~# /usr/local/httpd24/bin/apachectl startroot@dev:~# ps -ef | grep httpdroot   24411 17534 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startdaemon  24412 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startdaemon  24413 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startdaemon  24414 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startdaemon  24415 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startdaemon  24416 24411 0 06:15 ?    00:00:00 /usr/local/httpd24/bin/httpd -k startroot   24418 24367 0 06:15 pts/19  00:00:00 grep --color=auto httpd

修改配置文件( vim /etc/httpd24/httpd.conf )

ServerName 127.0.0.1

DocumentRoot 后面指定一个网站根目录

总结

以上所述是小编给大家介绍的ubuntu16.04 linux 编译安装apache2.4.33的教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对武林网网站的支持!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表