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

    1.安装步骤:

    解压源文件:

    1 tar zvxf httpd-2.2.21.tar.gz 
    2 cd httpd-2.2.21
    3 ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
    4 make
    5 make install

    运行./configure 命令进行编译源代码,

    --prefix=/usr/local/apache2 是设置编译安装到的系统目录,

     --enable-so  参数是使httpd服务能够动态加载模块功能,

    --enable-rewrite  是使httpd服务具有网页地址重写功能。

    2.启动apache:

    /usr/local/apache2/bin/apachectl start

    3.将apache加入到系统服务,用service命令来控制apache的启动和停止

    •  首先以apachectl脚本为模板生成Apache服务控制脚本:

      grep -v "#" /usr/local/apache2/bin/apachectl  > /etc/init.d/httpd

    • 用vi编辑Apache服务控制脚本/etc/init.d/httpd:

      vi /etc/init.d/httpd

    • 在文件最前面插入下面的行,使其支持chkconfig命令:

      #!/bin/sh              

      # chkconfig: 2345 85 15              

      # description: Apache is a World Wide Web server.

    • 保存后退出vi编辑器,执行下面的命令增加Apache服务控制脚本执行权限:    

      chmod  +x  /etc/init.d/httpd

    • 执行下面的命令将Apache服务加入到系统服务:    

      chkconfig --add httpd

    • 执行下面的命令检查Apache服务是否已经生效:    

      chkconfig --list httpd              

    • 命令输出类似下面的结果:              

      httpd          0:off 1:off 2:on 3:on 4:on 5:on 6:off       

      表明httpd服务已经生效,在2、3、4、5运行级别随系统启动而自动启动,以后可以使用service命令控制httpd的启动和停止。  

    • 启动httpd服务:   service httpd start   
    • 停止httpd服务:        service httpd stop   
    • 执行下面的命令关闭开机自启动:      chkconfig httpd off
  • 相关阅读:
    fork安全的gettid高效实现
    TCP_DEFER_ACCEPT的坑
    TCP Linger的坑
    Blade和其他构建工具有什么不同
    在Blade中结合gperftools检查内存泄露
    GraphViz web版
    用户场景分析
    java-二维数组——with 刘童格
    java-四则运算-五-网页版--with刘童格
    java-四则运算-四
  • 原文地址:https://www.cnblogs.com/Monitor/p/4506299.html
Copyright © 2011-2022 走看看