1.下载Apache2.4.9 http://httpd.apache.org/download.cgi html
2.tar httpd-2.4.9压缩包
tar -zxvf httpd-2.4.9 apache
3.进入httpd-2.4.9文件夹
cd httpd-2.4.9 vim
4.下载apr-1.5.1.tar.gz http://apr.apache.org/download.cgi
若是有apr能够跳过此步骤
tar apr-1.5.1.tar.gz
复制apr文件夹到 /usr/local/apache下
cp -vRp /home/sniper/Downloads/apr-1.5.1 /usr/local/apache
进入apr文件夹
cd apr
编译
./configure
安装
make & make install 浏览器
5.下载apr-util-1.5.3.gz http://apr.apache.org/download.cgi
tar apr-util-1.5.3.gz
复制到/usr/local/apache下
cp -vRp /home/sniper/Downloads/apr-util-1.5.3 /usr/local/apache
重命名
mv /usr/local/apache/apr-util-1.5.3 /usr/local/apache/apr-util
进入apr-util文件夹下
cd /usr/local/apache/apr-util
编译
./configure --with-apr=/usr/local/apache/apr
安装
make & make install 测试
6.下载pcre-config http://pcre.org
tar pcre-8.3.5
mv 到 /usr/local/apache
cd /usr/local/apache/pcre-8.3.5
./configure
make & make install rest
7.从新安装apr-util htm
8.进入httpd目录
cd /home/sniper/httpd ip
9.编译
./configure --prefix=/usr/local/apache
make & make install it
10.启动apache
bin/apachectl start
若是出现 /usr/local/apache/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
的错误,输入
sudo ldconfig
从新启动服务
若是出现
/usr/local/apache/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory错误
打开配置文件 vim /usr/local/apache/conf/httpd.conf
找到 #ServerName www.example.com:80 把 # 注释去掉,重启
重启命令:bin/apachectl restart 编译
11.添加测试文件 /usr/local/apache/htdocs/test.html hello world !
12.浏览器中输入 http://localhost/test.html
13.关闭apache bin/apachectl stop