zoukankan      html  css  js  c++  java
  • CentOS 6.2 源码包安装apache2.4.3以及相关异常处理

    一.准备环境
    1.安装gcc
    [root@localhost /]# yum install gcc gcc-c++
    2.安装apr,apr-util
    下载apr-1.4.6.tar.gz与apr-util-1.5.1.tar.gz,
    地址:http://apr.apache.org
    上传至/usr/local,
    安装目录分别为/usr/local/apr 与/usr/local/apr-util
    a.安装apr-1.4.6.tar.gz
    [root@localhost local]# mkdir -p apr
    [root@localhost local]# tar -zxf apr-1.4.6.tar.gz
    [root@localhost local]# cd apr-1.4.6
    [root@yahoo apr-1.4.6]# ./configure --prefix=/usr/local/apr
    [root@yahoo apr-1.4.6]# make
    [root@yahoo apr-1.4.6]# make install b.安装apr-util-1.5.1.tar.gz
    [root@localhost local]# mkdir -p apr-util
    [root@localhost local]# tar -zxf apr-util-1.5.1.tar.gz
    [root@localhost local]# cd apr-util-1.5.1
    [root@yahoo apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util
    --with-apr=/usr/local/apr/bin/apr-1-config
    [root@yahoo apr-util-1.5.1]# make
    [root@yahoo apr-util-1.5.1]# make install 3.安装pcre-8.20.tar.gz
    下载地址:http://sourceforge.net/projects/pcre/files/pcre/ ,
    上传至/usr/local,
    安装目录为/usr/local/pcre[root@localhost local]# mkdir -p pcre[root@localhost local]# tar -zxf pcre-8.20.tar.gz[root@localhost local]# cd pcre-8.20[root@yahoo pcre-8.20]# ./configure --prefix=/usr/local/pcre[root@yahoo pcre-8.20]# make[root@yahoo pcre-8.20]# make install
    二.安装apache
    1.下载httpd-2.4.3.tar.gz,
    地址是:http://httpd.apache.org/ ,
    上传至/usr/local,
    安装目录为/usr/local/apache2
    2.安装
    [root@localhost local]# mkdir -p /usr/local/apache2
    [root@localhost local]# tar zxvf httpd-2.4.3.tar.gz
    [root@localhost local]# cd httpd-2.4.3
    [root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2
    --with-pcre=/usr/local/pcre
    --with-apr=/usr/local/apr
    --with-apr-util=/usr/local/apr-util
    [root@localhost httpd-2.4.3]# make
    [root@localhost httpd-2.4.3]# make install
    用浏览器访问http:localhost,看到It works!,说明CentOS Apache安装成功了,恭喜您! 3.启动第一种方法
    [root@localhost apache2]# /usr/local/apache2/bin/apachectl start 第二种方法
    [root@localhost apache2]#service httpd start 第三种方法
    [root@localhost apache2]#
    /etc/init.d/httpd start
    第三种方法:
    [root@localhost httpd-2.4.43]# sysytemctl start httpd

    三.安装出现的问题.
    1.configure: error: no acceptable cc found in $PATH
    解决办法:yum install gcc gcc-c++
    2.configure: error: APR not found. Please read the documentation.
    解决方法:安装Apache的关联软件如上安装apr-1.4.6.tar.gz 3.configure: error: APR-util not found. Please read the documentation
    解决方法:安装apr-util如上安装apr-util-1.5.1.tar.gz 4.configure: error: APR version 1.3.0 or later is required
    主要是因为apr版本过低造成的,应该卸载相关旧版本
    5. 启动时报错: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
    解救办法:绝对路径即可:/usr/local/apache2/bin/apachectl start 6.AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message98)Address already in use: AH00072: make_sock: could not bind to address [::]:80(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80no listening sockets available, shutting downAH00015: Unable to open logs
    解救办法:端口被占用:停止之前的服务或占用端口的服务,再次执行启动即可

    四.重要配置文件目录/etc/httpd/conf/httpd.conf  
    [root@localhost httpd-2.4.43]# sysytemctl stop httpd
    最主要的配置文件
      /usr/lib/httpd/modules:apache  
    支持很多的模块,所以你想要使用的模块默认都放置在此目录/var/log/httpd        
    apache默认的log/var/www/html    
    cenos默认的首页所在目录 五.配置apache
    最后修改httpd.conf,
    使apache能使用php增加如下参数
    AddType application
    /x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    AddType image/x-icon .ico DirectoryIndex index.php index.html index.html.var
  • 相关阅读:
    牛客练习赛19 D-托米去购物
    牛客练习赛19 托米的简单表示法
    Codeforces Round #492 (Div. 2) [Thanks, uDebug!]
    Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017
    Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017
    Codeforces Round #491 (Div. 2) E
    I00018 生成全1数
    I00017 生成9开头的按位递减数
    I00017 生成9开头的按位递减数
    HDU1042 n!
  • 原文地址:https://www.cnblogs.com/blogxu/p/HTTPD2.html
Copyright © 2011-2022 走看看