基本编译参数:CC=gcc CFLAGS=”-O2″ ./configure –prefix=/usr/local/httpd22 –enable-proxy –enable-proxy-ajp –enable-proxy-balancer –enable-expires–enable-headers –disable-asis –disable-auth -disable-autoindex –disable-userdir –enable-rewrite –disable-cgi –disable-cgid –disable-access –enable-charset-lite –enable-deflate –disable-status –enable-ssl=static –with-ssl=/usr/local/openssl
make
make install
如果出现找不到zlib的情况,可参考前面博文,安装zlib rpm,或者自己下载源码安装,然后加上 –with-z=/usr/local/zlib125
如果出现“SSL/TLS libraries were missing ”,则在configure之前,运行:
export LDFLAGS=-ldl
生成证书
openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
注意 common name填写网站域名
修改apache配置
httpd.conf里面去掉下面 Include 前面的注释符
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
编辑httpd-ssl.conf里面的vhost项目
留意下面3个参数的内容
ServerName www.example.com:443
SSLCertificateFile /etc/httpd/conf/server.crt
SSLCertificateKeyFile /etc/httpd/conf/server.key