Linux 下配置Apache Http Server

以前公司都是用的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 autoconf
autoreconf -ivf
错误
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'htpasswd' failed
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory '/etc/httpd-2.4.27/support'
/etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/etc/httpd-2.4.27/support'
/etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
解决;

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


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在Linux中离线更新Apache HTTP Server的详细步骤: 1.准备工作 在更新之前,我们需要先下载新版Apache HTTP Server的安装包,并将其上传到Linux服务器中。假设我们已将安装包上传到`/home/user/httpd-2.4.51.tar.gz`。 2.备份旧版Apache HTTP Server 在更新之前,我们需要备份旧版Apache HTTP Server配置文件和数据文件,以防万一。可以使用以下命令备份: ``` sudo cp -rp /etc/httpd /etc/httpd-backup sudo cp -rp /var/www /var/www-backup ``` 3.卸载旧版Apache HTTP Server 使用以下命令卸载旧版Apache HTTP Server: ``` sudo yum remove httpd ``` 4.解压和编译新版Apache HTTP Server 解压上传的安装包并进入解压后的目录。然后运行以下命令以配置、编译和安装新版Apache HTTP Server: ``` cd /home/user tar -zxvf httpd-2.4.51.tar.gz cd httpd-2.4.51 ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-rewrite make sudo make install ``` 上述命令中,“--prefix”指定Apache HTTP Server的安装路径,“--enable-so”开启动态模块支持,“--enable-ssl”启用SSL支持,“--with-ssl”指定SSL库的路径,“--enable-rewrite”启用URL重写模块。 5.复制旧版Apache HTTP Server配置文件 使用以下命令将旧版Apache HTTP Server配置文件复制到新版Apache HTTP Server配置目录中: ``` cd /etc/httpd-backup sudo cp httpd.conf /usr/local/apache2/conf/httpd.conf ``` 6.启动新版Apache HTTP Server 使用以下命令启动新版Apache HTTP Server: ``` sudo /usr/local/apache2/bin/apachectl start ``` 7.检查Apache HTTP Server的版本号 使用以下命令检查Apache HTTP Server的版本号: ``` sudo /usr/local/apache2/bin/httpd -v ``` 以上就是在Linux中离线更新Apache HTTP Server的详细步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值