Ubuntu 14.10下Apache的安装配置

1、安装准备

a)        cd  /usr/local/src

b)        sudo  wget  http://mirror.bit.edu.cn/apache/apr/apr-1.5.1.tar.gz

c)        sudo  wget  http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz

d)        sudo            wget    http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.12.tar.gz

2、安装必要的工具

sudo  apt-get  install  libpcre3  libpcre3-dev openssl  libssl-dev

3、解压缩及配置

a)        tar –zxvf httpd-2.4.12

b)        tar –zxvf arp-1.5.1

c)        tar –zxvf arp-util-1.5.4

d)        cp –rf apr-1.5.1 httpd-2.4.12/srclinb/apr

e)        cp –rf apr-util-1.5.4 httpd-2.4.12/srclinb/apr-util

f)          cd httpd-2.4.12/

g)        sudo./configure .

--prefix=/usr/local/apache

--with-apr=/usr/local/apr

--with-apr-util=/usr/local/apr-util

--with-pcre=/usr/local/pcre

--with-included-apr

 --with-ssl

--enable-ssl

--enable-module=so

--enable-rewrite

--enable-cgid

--enable-cgi    #配置

注释: apache安装的check过程中出错

        Checking for APR-util…no

        Configure: error: APR-util not found. Please read the docummention.

                  需要在/usr/local目录下安装pcre

                  # tar -zxvf pcre-8.32.tar.gz

                #cd pcre-8.32

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

                #make

                #make install

h)        sudo make –j4

i)          sudo make install

                                           

4、安装完毕,进行简单配置

a)        sudo cp build/rpm/httpd.init /etc/init.d/httpd

b)        sudo chmod 755 /etc/init.d/httpd

c)        sudo ln -fs /usr/local/apache/ /etc/httpd

d)        sudo ln -fs /usr/local/apache/bin/httpd /usr/sbin/httpd

e)        sudo ln -fs /usr/local/apache/bin/apachectl /usr/sbin/apachectl

f)          sudo ln -fs /usr/local/apache/logs /var/log/httpd

g)        sudo ln -s /usr/local/apache/conf/httpd.conf /etc/

5、简单测试

a)        修改./apache/conf/httpd.cof配置文件

                      i.              查找到Listen 80,打开注释并修改为0.0.0.0:8081,80端口有可能被其他服务占用。

                      ii.              在DirectoryIndex中添加index.php

                      iii.              去掉以下2个注释:
1.# include conf/extra/httpd-mpm.cof
2.# include conf/extra /httpd-default.cof

                      iv.              查找到ServerName, 打开注释将ServerName的值修改为对应的IP地址

b)        保存httpd.cof文件的修改,启动apache服务

                        i.              sudo apachectl start

                      ii.              netstat –ant 查看httpd服务是否启动

c)        如果正常就可用IP:8081 访问 显示 It works!表示成功。

-------------------------------------我是分割线 -------------------------------------

--------------------------------------分割线 --------------------------------------

Apache 的详细介绍请点这里
Apache 的下载地址请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2015-05/117656.htm