博客
关于我
apache安装(httpd)
阅读量:775 次
发布时间:2019-03-25

本文共 1356 字,大约阅读时间需要 4 分钟。

安装 Apache 服务器 并设置服务配置

以下是 Apache 服务器 installation steps 以及服务配置方法的详细说明. 请按照步骤逐一执行 installation 以确保服务器高效稳定运行.

  • 首先 将 解压软件 复制到 httpd 的解压目录中. 解压目录请勿包含版本号.

  • 使用以下命令 将 library 文件复制:

    cp -r apr-1.4.6 httpd-2.4.2/srclib/apr
    cp -r apr-util-1.4.1 httpd-2.4.2/srclib/apr-util
  • 安装 必须的 compiler 工具:

    执行以下命令安装 ruptured 工具:

    yum -y install gcc gcc-c++ make pcre-devel
  • 安装完成后请确认 pcre-devel 已 installed.

    1. 配置 Apache 服务器:

      使用以下命令运行配置:

      ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most --with-mpm=worker --disable-cgid --disable-cgi

      配置参数说明如下:

      • --prefix:指定安装路径
      • --enable-so:支持 DSO 模块加载
      • --enable-rewrite:启用 URL 重写功能
      • --enable-mods-shared=most:启用大部分模块作为 DSO 模块
      • --with-mpm=worker:指定 Apache 运行方式为 worker обнаруж
    2. 编译安装 Apache:

      运行以下命令:

      make
      make install
    3. 服务管理:

      为了方便使用 chkconfig 管理服务,请按照以下步骤操作:

      首先编辑 init script:

      vi /etc/init.d/httpd

      在文件开头插入以下行:

      #!/bin/sh
      # chkconfig: 2345 85 15
      # description: Apache is a World Wide Web server.

      为文件赋予执行权限:

      chmod +x /etc/init.d/httpd

      将服务添加至 chkconfig:

      chkconfig --add httpd
    4. 验证服务配置:

      查看服务配置:

      chkconfig --list httpd
    5. 配置 Apache 服务器主配置文件:

      打开配置文件:

      vi /usr/local/apache/conf/httpd.conf

      添加或修改以下内容:

      • ServerName:设置服务器名称(可设置为 hostname)
      • Listen:设置监听地址和端口,如 Listen 192.168.5.2:80
    6. 生成系统启动配置:

      创建 symbolic link:

      ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
    7. 以上步骤请依次执行. 当完成所有步骤后,Apache 服务器即可正常运行. 如果有任何问题,请参考相关 documentation 或查阅错误日志.

    转载地址:http://taduk.baihongyu.com/

    你可能感兴趣的文章
    Nginx实战经验分享:从小白到专家的成长历程!
    查看>>
    nginx实现二级域名转发
    查看>>
    Nginx实现动静分离
    查看>>
    Nginx实现反向代理负载均衡
    查看>>
    nginx实现负载均衡
    查看>>
    Nginx实现限流
    查看>>
    Nginx将https重定向为http进行访问的配置(附Demo)
    查看>>
    nginx工作笔记004---配置https_ssl证书_视频服务器接口等
    查看>>
    nginx工作笔记005---nginx配置负载均衡_在微服务中实现网关集群_实现TCP传输层协议__http协议的负载均衡
    查看>>
    nginx常用命令及简单配置
    查看>>
    Nginx常用屏蔽规则,让网站更安全
    查看>>
    Nginx常见问题
    查看>>
    nginx平滑升级解决 nginx 安全漏洞(CVE-2021-23017)和NGINX 环境问题漏洞(CVE-2019-20372)
    查看>>
    Nginx平滑添加模块
    查看>>
    Nginx开启gzip网页传输压缩配置
    查看>>
    nginx开机启动脚本
    查看>>
    nginx异常:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf
    查看>>
    nginx总结及使用Docker创建nginx教程
    查看>>
    nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:128
    查看>>
    nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in usrlocalnginxconfnginx.conf128
    查看>>