快捷搜索:   服务器  安全  linux 安全  MYSQL  dedecms

LAMP服务器就环境的建立(2)

  ● 编译安装 Apache
  # cd /usr/local/src
  # wget http://www.ip97.com/apache.org/httpd/httpd-2.2.6.tar.gz
  # tar zxvf httpd-2.2.6.tar.gz
  # cd httpd-2.2.6

  依次安装apr和apr-util

  # cd srclib/apr
  # ./configure --prefix=/usr/local/apr --enable-threads --enable-other-child --enable-static
  # make && make install

  # cd ../apr-util
  #  ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ --with-mysql=/usr/local/mysql
  # make && make install

  #cd /usr/local/src/httpd-2.2.6
  #  ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --with-mysql=/usr/local/mysql --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid  --enable-mod_cgi  --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
  # make
  # make install

  注解:
  ./configure //配置源代码树
  --prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。
  --enable-module=so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块
  --enable-mods-shared=all //编译全部的模板,对于不需要我们可以在httpd.conf去掉。
  --enable-cache //支持缓存
  --enable-file-cache //支持文件缓存
  --enable-mem-cache //支持记忆缓存
  --enable-disk-cache //支持磁盘缓存
  --enable-static-support //支持静态连接(默认为动态连接)
  --enable-static-htpasswd //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件
  --enable-static-htdigest //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件
  --enable-static-rotatelogs //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序
  --enable-static-logresolve //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名
  --enable-static-htdbm //使用静态连接编译 htdbm - 操作 DBM 密码数据库
  --enable-static-ab //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具
  --enable-static-checkgid //使用静态连接编译 checkgid
  --disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本
  --disable-cgi //禁止编译 CGI 版本的 PHP
  我们不再使用worker模式编译apache,worker模式和php貌似有一些不协调不稳定之处。所以使用了默认的perfork模式。

  将apache设置成开机自启动:

  在/etc/rc.d/rc.local文件中加入一行
  /usr/local/apache2/bin/apachectl start
  这样每次重新启动系统以后,apache也会随系统一起启动.

  或者
  # cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
  然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)
  # chkconfig: 2345 10 90
  # description: Activates/Deactivates Apache Web Server
  最后,运行chkconfig把Apache添加到系统的启动服务组里面:
  # chkconfig --add httpd
  # chkconfig httpd on
或者:

  # echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.d/rc.local //将 apachectl 的调用加入到你的系统启动文件中。

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论