zoukankan      html  css  js  c++  java
  • Linux 源码安装httpd

    安装apr

    下载解压apr-1.4.5 

    ./configure --prefix=/usr/local/apr
    make
    sudo make install

    安装apr-util

    下载解压apr-util-1.5.2

    ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr
    make
    sudo make install

    安装pcre

    下载解压pcre-7.8.tar.gz

    ./configure --prefix=/usr/local/pcre
    make
    sudo make install

    安装httpd

    下载解压httpd-2.4.12

    ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so --enable-rewrite
    make
    sudo make install

    --enable-so 支持DSO模式(动态模块加载方式)
    --enable-rewrite 支持rewrite(地址重定向)

    建立软链接

    sudo ln -s /usr/local/httpd/bin/apachectl /usr/local/bin/apachectl

    启动

    sudo apachectl start

    启动异常

    $sudo ./apachectl start

    AH00557: httpd: apr_sockaddr_info_get() failed for test10.125.8.116
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
    

    原因:这个问题应该是没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName。所以apache会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。

    解决:在/etc/httpd/conf/httpd.conf中添加上ServerName=****

    验证

    打开浏览器输入ip,显示It works! 表示成功了。

    添加网页

    文件:/usr/local/httpd/htdocs/test.html

    内容

    <html>
    <body>
    <h1>
    Test works OK!
    </h1>
    </body>
    </html>

    重启服务

    sudo apachectl restart

    验证

    配置

    1. 修改Web站点目录

    默认的Web站点目录:/usr/local/apache2/htdocs,如果修改,例如"/home/gyw/WebSite"的目录作为apache的站点目录

      找到DocumentRoot这一行修改为:DocumentRoot "/home/gyw/WebSite"

      找到 <Directory> 这一行修改为:<Directory "/home/gyw/WebSite"> 

      

  • 相关阅读:
    378. Kth Smallest Element in a Sorted Matrix
    295. Find Median from Data Stream
    857. Minimum Cost to Hire K Workers
    373. Find K Pairs with Smallest Sums
    767. Reorganize String
    无序列表
    有序列表
    缩写
    设计者详细信息
    强调
  • 原文地址:https://www.cnblogs.com/kaituorensheng/p/5162560.html
Copyright © 2011-2022 走看看