Linux 下配置Apache Http Server

来源:互联网 发布:网络mg老虎机出分原理 编辑:程序博客网 时间:2024/06/05 17:24

以前公司都是用的Apache的Tomcat,这个web 服务器用起来比较简单,下载解压就好了。最近在想弄个博客要用到Apache Http Server,在网上看了很多安装方法,感觉还是一脸懵,然后去看了下官网安装说明,弄懂了一点,现在记录一下我安装Apache Http Server 2.4.27的过程。

  安装环境:apr 和apr-util
官网下载apr和apr-util并分别解压到 aprpath和apr-utilpath(路径自定义)
   安装apr:
 cd aprpath
./configure --prefix=aprpath
sudo make
sudo make install
安装apr-util:
 cd apr-utilpath
./configure --prefix=apr-utilpath  --with-apr=aprpath/bin/apr-1-config
sudo make
sudo make install    
    安装环境:pcre    官网下载pcre安装方法类似apr
最后安装httpd:官网下载httpd服务器 解压到目录 httpd-NN(路径自定义)
cd httpd-NN
sudo ./configure --prefix='/etc/httpd-2.4.27' --with-apr=aprpath/bin/apr-1-config  --with-apr-util=apr-utilpath/bin/apu-1-config' --with-included-apr --with-pcre=pcrepath/bin/pcre-config

出现到错误
xml/apr_xml.c:35:19: fatal error: expat.h: 没有那个文件或目录
解决:
sudo apt-get install libexpat1-dev
错误:
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /etc/httpd-2.4.27/httpd_source_tree_root/pcre-8.41/missing aclocal-1.15 -I m4/etc/httpd-2.4.27/httpd_source_tree_root/pcre-8.41/missing: 行 81: aclocal-1.15: 未找到命令WARNING: 'aclocal-1.15' is missing on your system.         You should only need it if you modified 'acinclude.m4' or         'configure.ac' or m4 files included by 'configure.ac'.         The 'aclocal' program is part of the GNU Automake package:         <http://www.gnu.org/software/automake>         It also requires GNU Autoconf, GNU m4 and Perl in order to run:         <http://www.gnu.org/software/autoconf>         <http://www.gnu.org/software/m4/>         <http://www.perl.org/>Makefile:1357: recipe for target 'aclocal.m4' failed
解决:
sudo apt install autoconfautoreconf -ivf
错误
collect2: error: ld returned 1 exit statusMakefile:48: recipe for target 'htpasswd' failedmake[2]: *** [htpasswd] Error 1make[2]: Leaving directory '/etc/httpd-2.4.27/support'/etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failedmake[1]: *** [all-recursive] Error 1make[1]: Leaving directory '/etc/httpd-2.4.27/support'/etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failedmake: *** [all-recursive] Error 1
解决;

编译httpd的时候加上 --with-apr=aprpath/bin/apr-1-configure