创建apache安装后的目录,/home/work/oem/apache
1、编译安装apr
cd /home/work/tools
tar –xzvf apr-1.4.8.tar.gz
cd apr-1.4.8
./configure --prefix=/home/work /oem/apache/apr
make
make install
2、编译安装apr-util
cd /home/work/tools
tar –xzvf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure--prefix=/home/work/oem/apache/apr_util --with-apr=/home/work/oem/
apache/apr
make
make install
3、编译安装pcre
tar xjpf pcre-7.8.tar.bz2
cd pcre-7.8
./configure --prefix=/usr/local/pcre-7.8--libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre
make
make install
4、编译安装openssl
tar zxvf openssl-1.0.0e.tar.gz
cd openssl-1.0.0e/
./config --prefix=/usr/local--openssldir=/usr/local/ssl
make && make install
5、编译安装apache
cd /home/work/tools
tar –xzvf httpd-2.2.21.tar.gz
cd httpd-2.2.21
./configure --prefix=/home/sunzhijie/software/apache--enable-mods-shared=all --enable-so --with-mpm=worker --enable-deflate --enable-cache--enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy--enable-rewrite --enable-charset-lite --enable-suexec--with-suexec-bin=/usr/sbin/suexec --disable-ipv6 -disable-dav--with-apr=/home/sunzhijie/software/apache/apr --with-apr-util=/home/sunzhijie/software/apache/apr-util--sysconfdir=/home/sunzhijie/software/apache/conf--with-pcre=/home/sunzhijie/software/apache/pcre-8.33--with-ssl=/home/sunzhijie/software/openssl
make
make install
更改apache配置
cd /home/work/oem / apache/conf
vimhttpd.conf
Listen 80 改为 Listen 8080 #只有root用户才能启动80端口
cd /home/work/oem / apache/bin
./httpd –k start #启动apache服务器
访问服务器的8080端口,如cp01-sys-ra09-jueheng2qa078.cp01.baidu.com:8080,确认apache可正常启动。
安装完成后建议把apache加入到系统路径中去,这样就可以直接使用httpd命令了,方法如下:
cd /home/work/&& vim ./.bashrc #编辑bashrc文件
export PATH=/home/work/oem/apache/bin:$PATH #在bashrc文件中加入以下语句
问题:
a、httpd:apr_sockaddr_info_get() failed、using localhost.localdomain for ServerName
解决方法:于httpd.conf中添加ServerName localhost:80
b、configure:error: APR-util version 1.2.0 or later is required
解决方法:安装的pcre未起作用,apt-getinstall libpcre3-dev安装了pcre
c、 No address associated with hostname: mod_unique_id: unable to findIPv4 addr
解决方法:注释掉httpd.con中的LoadModuleunique_id_module libexec/apache2/mod_unique_id.so