apache httpd 配置

服务器centos 5.5

  1. http://httpd.apache.org 下载apache httpd服务器,此处下载httpd-2.4.3.tar.gz
  2. wget http://apache.mesi.com.ar/apr/apr-1.4.6.tar.gz
  3. wget http://apache.mesi.com.ar/apr/apr-util-1.4.1.tar.gz
  4. http://pcre.org 下载pcre-8.31.tar.gz
  5. http://www.openssl.org/source/ 下载

     

    openssl-1.0.1c.tar.gz

  6. 解压上面下载的5个文件,#tar zxf httpd-2.4.3.tar.gz

  7. 将apr-1.4.6.tar.gz和apr-util-1.4.1.tar.gz解压后的文件放入httpd-2.4.3/srclib/目录中,并去掉版本号,

  8. 编译安装pcre,进入pcre-8.31.tar.gz解压后的目录,#./configure --prefix=/usr/local/pcre #make&make install

  9. 安装openssl,进入openssl-1.0.1c.tar.gz解压后的目录,#./Configure --prefix=/usr/local/ssl #make&make install

  10. 安装apache httpd,进入httpd-2.3.4.tar.gz解压后的目录,#./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --with-included-apr --with-pcre=/usr/local/pcre –with-ssl=/usr/local/ssl #make&make install

  11.  配置apache以支持SSL,打开apache的配置文件conf/httpd.conf  LoadModule ssl_module modules/mod_ssl.so  Include conf/extra/httpd-ssl.conf   去掉两行前面的#

  12. 配置conf/extra/httpd-ssl.conf,找到SSLSessionCache  "shmcb:/usr/local/apache2/logs/ssl_scache(512000)"

    扫描二维码关注公众号,回复: 356175 查看本文章

    改为:SSLSessionCache  nonenotnull

  13. /usr/local/apache2/conf/目录下,#/usr/local/ssl/bin/openssl req -new -x509 -nodes -out server.crt -keyout server.key

  14. 启动apache httpd#./apachectl -k start,在浏览器输入http://localhost/https://localhost:443/ ,如果页面正常,那么说明安装成功了

     

     

    P.S.如果出现类似下面的错误:

    libtool: compile: unrecognized option `-DHAVE_CONFIG_H'

    libtool: compile: Try `libtool --help' for more information.

    make[1]: *** [pcrecpp.lo] 错误 1

    make[1]:正在离开目录 `/root/pcre-8.30'

    make: *** [all] 错误 2

    这个错误,基本可以断定是缺少系统包造成的,但是缺少哪个包却不明确,这里记录下,这个错误是缺少安装gcc-c++

    redhat 系列只需 yum -y install gcc-c++

    Debian系列只需 apt-get install gcc g++ autoconf

     

猜你喜欢

转载自lanhuidong.iteye.com/blog/1692280