Apache源码安装

1 下载安装包

apr-1.7.0.tar.gzapr-util-1.6.1.tar.gzpcre-8.43.tar.gzhttpd-2.4.41.tar.gzhttps://github.com/purple910/Linux

2 解压

tar -zxf apr-1.7.0.tar.gztar -zxf apr-util-1.6.1.tar.gztar -zxf pcre-8.43.tar.gztar -zxf httpd-2.4.41.tar.gz

3 添加httpd对于apr,apr-util,pcre的依赖

cp -r apr-1.7.0 httpd-2.4.41/srclib/aprcp -r util-1.6.1 httpd-2.4.41/srclib/apr-utilcp -r pcre-8.43 httpd-2.4.41/srclib/pcre

4 安装apr

cd apr-1.7.0gedit configure(将 $RM "$cfgfile" 注释掉)./configure --prefix=/usr/local/src/aprmake && make install

5 安装apr-util

cd .././apr-util-1.6.1./configure –prefix=/usr/local/src/apr-util –with-apr=/usr/local/src/aprmake && make install(如果报错 缺少expat.h)yum install -y expat-devel.x86_64

6 安装prce

cd .././ pcre-8.43./configure –prefix=/usr/local/src/pcremake && make install

7 安装httpd

cd .././ httpd-2.4.41./configure --with-included-apr --sysconfdir=/etc/httpd --prefix=/usr/local/src/apache2.4 --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/apr-util --with-pcre=/usr/local/src/pcre --enable-so --enable-unixd --enable-rewritemake && make install

8 关闭防火墙

server firewall stop

9 编辑httpd的配置文件

vim /etc/httpd/httpd.conf#ServerName www.example.com:80ServerName 172.0.0.1:80

10 添加apache的快捷方式

cp /usr/local/src/apache2.4/bin/apachectl  /etc/init.d/httpdln -s /etc/init.d/httpd /etc/rc.d/S85httpd

11 修改httpd

 vim /etc/rc.d/init.d/httpd# chkconfig: 345 85 15# description: Activates/Deactivates Apache Web Server

12 运行httpd

server httpd startAH00558: httpd: Could not reliably determine the server's fully qualified domain name,using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
(0)

相关推荐