Linux 安装 Apache

来源:互联网 发布:淘宝粉丝排名前十店铺 编辑:程序博客网 时间:2024/05/29 05:05

安装环境     Linux 2.6.32-279.el6.x86_64  Server release 6.3 


准备:

  安装的版本:httpd-2.4.12。安装时需要apr(Apache Portable Runtime)和pcre  可搜索下载, 我在百度网盘上放了一份也可使用, 地址:http://pan.baidu.com/s/1sjqVXTj。


安装步骤:

1.  mkdir /usr/local/apr
    ./configure --prefix=/usr/local/apr  

    make;  make install


2.  mkdir /usr/local/apr-util

     ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

        make;  make install


3.  mkdir /usr/local/pcre

    ./configure --prefix=/usr/local/pcre

    make;  make install


4. mkdir /usr/local/apache2

./configure --prefix=/usr/local/apache2 --enable-module=shared --with-apr-util=/usr/local/apr-util \
  --with-pcre=/usr/local/pcre
make 
make install 


启动

/usr/local/apache2/bin/apachectl start

可能会提示:AH00558: httpd: Could not reliably determine the server's fully qualified domain name

vi /usr/local/apache2/conf/httpd.conf 

找到ServerName 修改为ServerName 127.0.0.1:80


在浏览器地址栏中输入IP,显示 ‘It Works!’ 表示安装成功。


开机启动

          在文件 /etc/rc.d/rc.local 添加一行启动命令即可。


2 0