NGINX 负载均衡模拟之准备工作 APACHE编译安装

本文详细记录了Apache服务器从下载到安装再到配置的全过程,包括解决安装过程中遇到的APR及APR-UTIL缺失问题,以及如何更改监听端口并解决启动错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 下载Apache包;

   安装目录在usr/local/

   cd /usr/local/

   wget http://www.apache.org/dist/httpd/httpd-2.4.18.tar.gz.md5

   tar zxvf httpd-2.4.18.tar.gz

   ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl

   报错:error: APR not found

2 下载APR

   cd /usr/local/

   wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz

   tar zxvf apr-1.5.2.tar.gz

   cd apr-1.5.2  

   ./configure --prefix=/usr/local/apr

    make

    make install 

    再次尝试

    ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/

    configure: error: APR-util not found

 

3 下载 APR-UTIL

   cd /usr/local/

   wget http://www.apache.org/dist/apr/apr-util-1.5.4.tar.gz.md5

   tar zxvf apr-util-1.5.4.tar.gz

   cd apr-util-1.5.4

   ./configure --prefix=/usr/local/apr-util

   报错:configure: error: APR could not be located

   ./configure -with-apr=/usr/local/apr

 

   cd    /usr/local/httpd-2.4.18

   增加参数 apr and apr-util

   ./configure -with-apr-util=/usr/local/apr-util

   ./configure -with-apr=/usr/local/apr

   再次尝试:

   ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/

   checking for APR-util... configure: error: the --with-apr-util parameter is incorrect.

   大小写问题:

   ./configure -with-APR-util=/usr/local/apr-util

   ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-APR-util=/usr/local/apr-util/

    make;

    make install;

    安装后一直再找启动文件;找了好久没找到;查看安装时候信息;

    

    cd /usr/local/apache2/bin 

   

    ./httpd -k start

  AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.116.148.100. Set the 'ServerName' directive globally to suppress this message
   (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
   no listening sockets available, shutting down

   

   端口被占用;

   cd ..

   cd conf/

   vim httpd.conf 

   listen 8080

   再尝试

   AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.116.148.100. Set the 'ServerName' directive globally to suppress this message

   访问ip:8080

  It works!

    实际上已经跑起来了。

    解决下AH00558 

    cd /usr/local/apache2/conf

    vim httpd.conf

    增加 ServerName localhost:8080

    重新尝试就可以了;

    

      

   

 

   

 

   

 

 

 

   

 

转载于:https://www.cnblogs.com/bin-pureLife/p/5073578.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值