apache中使用mod_gnutls模塊實現(xiàn)多個SSL站點配置(多個HTTPS協(xié)議的虛擬主機)
在apache的環(huán)境下該如何配置多個HTTPS虛擬主機呢?利用的原理的都是同一個,也就是SNI。基于域名的虛擬主機,即共享同一個IP地址和端口的HTTPS虛擬主機。
SNI—服務器名稱指示,是一個TLS的擴展,它使得啟用SSL的基于域名的虛擬主機的配置成為可能。打破了每個HTTPS的虛擬主機需要一個IP地址的要求。因此,成本大大降低,因為所有的HTTPS虛擬主機可以共享相同的IP地址和端口,使HTTPS Web服務的更簡單。
在apache環(huán)境下,需要使用mod_gnutls來實現(xiàn)同一個IP上配置多個HTTPS主機。下面來看看實現(xiàn)過程:
mod_gnutls的網(wǎng)址參見:https://mod.gnutls.org
1. 安裝mod_gnutls
# yum install httpd-devel gnutls-devel
# wget http://www.outoforder.cc/downloads/mod_gnutls/mod_gnutls-0.2.0.tar.bz2
# tar -xjvf mod_gnutls-0.2.0.tar.bz2
# cd mod_gnutls-0.2.0
# ./configure --prefix=/usr
# make
如果要安裝高版本的gnutls的話,需要先安裝相對應的依賴包libnettle gmplib。下載地址:http://www.gnutls.org/download.html ftp://ftp.gnutls.org/gcrypt/gnutls
mod_gnutls模塊依賴dhfile和rsafile文件.
3. 配置httpd.conf
Listen 10.1.1.22:443
LoadModule gnutls_module modules/mod_gnutls.so
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
GnuTLSCache dbm "/var/cache/mod_gnutls_cache"
GnuTLSCacheTimeout 300
NameVirtualHost 10.1.1.22:443
創(chuàng)建回話緩存目錄
# mkdir -m 0700 /var/cache/mod_gnutls_cache
# chown nobody.nobody /var/cache/mod_gnutls_cache
4. 配置虛擬主機
<VirtualHost 10.1.1.22:443>
ServerName www.dbjr.com.cn:443
GnuTLSEnable on
GnuTLSCertificateFile ./ssl/www.dbjr.com.cn.public.cer
GnuTLSKeyFile ./ssl/www.dbjr.com.cn.private.key
DocumentRoot "/data/wwwroot/www.dbjr.com.cn/webroot"
</VirtualHost>
<VirtualHost 10.1.1.22:443>
ServerName www.dbjr.com.cn:443
GnuTLSEnable on
GnuTLSCertificateFile ./ssl/www.dbjr.com.cn.public.cer
GnuTLSKeyFile ./ssl/www.dbjr.com.cn.private.key
DocumentRoot "/data/wwwroot/www.dbjr.com.cn/webroot"
</VirtualHost>
這樣訪問每個虛擬主機都正常。
相關(guān)文章
詳解linux下批量替換文件內(nèi)容的三種方法(perl,sed,shell)
本篇文章主要介紹了linux下批量替換文件內(nèi)容的三種方法(perl,sed,shell),具有一定的參考價值,感興趣的小伙伴們可以參考一下。2017-04-04
VirtualBox 錯誤:This kernel requires the following features no
這篇文章主要介紹了VirtualBox 錯誤:This kernel requires the following features not present on the CPU的相關(guān)資料,希望通過本文能幫助到大家,解決這樣的問題,需要的朋友可以參考下2017-10-10
Apache rewrite的重寫相關(guān)的參數(shù)說明
Apache的rewrite的重寫非常常用,現(xiàn)總結(jié)了一下.2008-08-08
Apache訪問出現(xiàn)501 Method Not Implemented錯誤解決
這篇文章主要介紹了Apache訪問出現(xiàn)501 Method Not Implemented錯誤解決,有些導致該錯誤的情況可以用文中修改配置文件的方法來解決,需要的朋友可以參考下2015-07-07

