linux安装apache

1.下载所需软件包:

  1. wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
  2. wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
  3. wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip 二、安装过程

    1、安装apr

    #cd /root/software
    #tar -jxvf apr-1.4.6.tar.bz2
    #cd apr-1.4.6
    #./configure
    #make
    #make install

    2、安装apr-util

    #cd /root/software
    #tar -jxvf apr-util-1.4.1.tar.bz2
    #cd apr-util-1.4.1
    #./configure --with-apr=/usr/local/apr
    #make
    #make install

    3、安装pcre

    #cd /root/software
    #tar -jxvf pcre-8.30.tar.bz2
    #cd pcre-8.30
    #./configure
    #make
    #make install

    4、安装apache

    #cd /root/software
    #tar -jxvf httpd-2.4.2.tar.bz2
    #cd httpd-2.4.2
    #./configure -prefix=/usr/local/apache -enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr/ --with-pcre=/usr/local/pcre/
    #make
    #make install


    三、运行
    1、进入/usr/local/apache/conf,将httpd.conf中:
    #ServerName www.example.com:80
    改为:
    ServerName localhost:80

    2、进入/usr/local/apache/bin,执行#./apachectl start

    3、在浏览器输入ip地址即可访问。

相关推荐