zoukankan      html  css  js  c++  java
  • Linux安装配置apache

    1.下载解压

    cd /usr/local/src/
    wget http://mirrors.sohu.com/apache/httpd-2.4.18.tar.gz
    tar zvxf httpd-2.4.18.tar.gz
    cd httpd-2.4.18

    2.编译安装

    ./configure 
    
    --prefix=/usr/local/apache2 
    
    --with-included-apr 
    
    --enable-so 
    
    --enable-deflate=shared 
    
    --enable-expires=shared 
    
    --enable-rewrite=shared 
    
    --with-pcre
    解释:
    
    非常全的参数介绍 http://blog.chinaunix.net/uid-20784749-id-1844507.html
    
    编译介绍: http://www.linuxidc.com/Linux/2015-04/116060.htm
    
    常用参数: http://www.cnblogs.com/xianglf/archive/2010/12/16/1908174.html
    
    
    ./configure   编译安装
    
     
    
    --prefix  编译安装完成后生成一个目录,该软件所有的文件都会被复制到这个目录里面,为什么要指定这个目录呢?为了以后维护方便,如果不指定,文件会被复制到系统下各个目录,用prefix的另一个好处就是方便卸载和移植软件。把删除该目录,整个软件卸载的干干净净,移植只需要把这个目录拷贝到另一台机器即可。
    
     
    
    --with-included-apr  如果是开发者则使用此选项,利于连接apache的代码或者是调试apache,其消除了由于版本或者编译中跟APR或者APR-util代码产生的不匹配;
    
     
    
    --enable-so   让apache核心装载DSO
    
     
    
    --enable-deflate=shared  表示共享的方式编译压缩, apache开启gizp的压缩功能。网页压缩。扩展:http://blog.csdn.net/yybjroam05/article/details/7726516
    
     
    
    --enable-expires=shared  网站需要用到缓存功能,支持 HTTP 控制
    
     
    
    --enable-rewrite=shared  支持 URL 重写
    
     
    
    --with-pcre
    

      

    错误1

    configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
    
     
    
    apache-2.2与新出的apache-2.4安装不同的地方在于,2.4版的已经不自带apr库,所以在安装apache-2.4之前,需要下载apr。
    
    解决
    
    cd /usr/local/src  #源码包统一放到此目录
    
    wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2
    
    wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2
    
    tar -jxvf apr-1.5.2.tar.bz2
    
    tar -jxvf apr-util-1.5.4.tar.bz2
    
    cp -rf apr-1.5.2 ./httpd-2.4.18/srclib/apr
    
    cp -rf apr-util-1.5.4 ./httpd-2.4.18/srclib/apr-util
    
    #重新执行 configure 命令:
    

      

    错误2

    checking for gcc... no
    
    checking for cc... no
    
    checking for cl.exe... no
    
    没有gcc编译器
    
    解决
    
    yum install gcc -y
    
    #重新执行 configure 命令:
    

      

     

    错误3

    configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org
    
     
    
    配置:错误:pcre-config libpcre不见了。PCRE是必需的,可以从http://pcre.org
    
    解决:
    
    yum -y install pcre-devel
    
    #重新执行 configure 命令:
    

      

    错误4

    checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
    
     
    
    检查是否启用mod_deflate……配置:错误:mod_deflate一直要求但是不能建立由于先决条件失败
    
    解决
    
    yum install  zlib-devel -y
    
    #重新执行 configure 命令:
    

      

    make
    
    make install
    

      

    保存镜像3.备注apache安装ok

    apache安装完成

    基本的操作方法:
    本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

    apahce启动命令:
    推荐/usr/local/apache2/bin/apachectl start apaceh启动

    apache停止命令
    /usr/local/apache2/bin/apachectl stop   停止

    apache重新启动命令:
    /usr/local/apache2/bin/apachectl restart 重启

    要在重启 Apache 服务器时不中断当前的连接,则应运行:

    /usr/local/sbin/apachectl graceful

    如果apache安装成为linux的服务的话,可以用以下命令操作:

    service httpd start 启动

    service httpd restart 重新启动

    service httpd stop 停止服务

     apache及依赖安装包链接:http://pan.baidu.com/s/1slRqtnn 密码:9uyz

  • 相关阅读:
    python 递归
    python 装饰器
    python函数作用域,嵌套函数,闭包
    排序算法总结
    经典排序算法学习笔记七——堆排序
    经典排序算法学习笔记六——归并排序
    经典排序算法学习笔记五——直接选择排序
    经典排序算法学习笔记四——希尔排序
    经典排序算法学习笔记三——插入排序
    经典排序算法学习笔记二——快速排序
  • 原文地址:https://www.cnblogs.com/cxscode/p/7349839.html
Copyright © 2011-2022 走看看