伺服器centos 5.5
- 從http://httpd.apache.org 下載下傳apache httpd伺服器,此處下載下傳httpd-2.4.3.tar.gz
- wget http://apache.mesi.com.ar/apr/apr-1.4.6.tar.gz
- wget http://apache.mesi.com.ar/apr/apr-util-1.4.1.tar.gz
- 從 http://pcre.org 下載下傳pcre-8.31.tar.gz
-
從http://www.openssl.org/source/ 下載下傳
openssl-1.0.1c.tar.gz
- 解壓上面下載下傳的5個檔案,#tar zxf httpd-2.4.3.tar.gz
- 将apr-1.4.6.tar.gz和apr-util-1.4.1.tar.gz解壓後的檔案放入httpd-2.4.3/srclib/目錄中,并去掉版本号,
- 編譯安裝pcre,進入pcre-8.31.tar.gz解壓後的目錄,#./configure --prefix=/usr/local/pcre #make&make install
- 安裝openssl,進入openssl-1.0.1c.tar.gz解壓後的目錄,#./Configure --prefix=/usr/local/ssl #make&make install
- 安裝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
- 配置apache以支援SSL,打開apache的配置檔案conf/httpd.conf LoadModule ssl_module modules/mod_ssl.so Include conf/extra/httpd-ssl.conf 去掉兩行前面的#
-
配置conf/extra/httpd-ssl.conf,找到SSLSessionCache "shmcb:/usr/local/apache2/logs/ssl_scache(512000)"
改為:SSLSessionCache nonenotnull
- 在/usr/local/apache2/conf/目錄下,#/usr/local/ssl/bin/openssl req -new -x509 -nodes -out server.crt -keyout server.key
- 啟動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