码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Ubuntu-server 22.04LTS源码编译apache服务器


    1 系统环境

    # cat /etc/os-release
    PRETTY_NAME="Ubuntu 22.04.3 LTS"
    NAME="Ubuntu"
    VERSION_ID="22.04"
    VERSION="22.04.3 LTS (Jammy Jellyfish)"
    VERSION_CODENAME=jammy
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=jammy
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    2下载源码文件

    2.1 创建目录

    # mkdir /data
    # cd /data
    # mkdir apache
    # mkdir pcre
    # mkdir apr-util
    # mkdir apr
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2.2 下载源码

    # wget https://mirrors.aliyun.com/apache/apr/apr-1.7.4.tar.gz
    # wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.3.tar.gz
    # wget http://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz
    # wget https://dlcdn.apache.org/httpd/httpd-2.4.57.tar.gz
    
    • 1
    • 2
    • 3
    • 4

    各自解压到响应文件夹

    2.3 编译 apr

    # ./configure --prefix=/usr/local/apr
    # make
    # make install
    
    • 1
    • 2
    • 3

    2.4 编译apr-util

    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
    # make 
    # make install
    
    • 1
    • 2
    • 3

    2.5 编译 pcre

    # ./configure --prefix=/usr/local/pcre
    # make
    # make install
    
    • 1
    • 2
    • 3

    2.6 编译httpd

    # ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
    # make
    # make install
    
    • 1
    • 2
    • 3

    3 相关错误记录

    3.1 报错libpcre.so.1不存在

    # ./apachectl start
    /usr/local/httpd/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    
    • 1
    • 2

    解决方法:

    echo "/usr/local/lib" >> /etc/ld.so.conf
    ldconfig
    
    • 1
    • 2

    3.2 告警domain

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

    修改配置文件:

    # cd conf
    # vi httpd.conf
    ...
    # If your host doesn't have a registered DNS name, enter its IP address here.
    #
    ServerName 0.0.0.0:80
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    注意,这是本地测试环境,如果有公网注册域名,可以使用,例如:www.baidu.com:80

    3.3 因为版本原因,执行编译httpd报错 working script at pcre-config

    ...
    checking for pcre-config... pcre-config
    configure: error: Did not find working script at pcre-config
    
    • 1
    • 2
    • 3

    PCRE默认指定路径尝试,

    # ./configure
    
    • 1

    完成后用如下命令监测:

    # whereis pcre-config
    pcre-config: /usr/local/bin/pcre-config
    
    • 1
    • 2
  • 相关阅读:
    347. 前 K 个高频元素——大顶堆、小顶堆
    使用chat-GPT接口提取合同中关键信息
    动态规划常见解题思路汇总!!刷了30道动规题目,血泪经验!
    Android Media3 ExoPlayer 开启缓存功能
    PMO、EMPO、P3O分别是什么
    (算法设计与分析)第三章动态规划-第一节3:动态规划之使用“找零钱”问题说明最优子结构如何解决
    网络公开课1
    Linux下lsof命令使用
    java毕业生设计在线考试系统演示录像2021计算机源码+系统+mysql+调试部署+lw
    对‘QBasicAtomicInt_fetchAndAddOrdered(int volatile*, int)’未定义的引用
  • 原文地址:https://blog.csdn.net/zhangh571354026/article/details/132921213
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号