How do I configure multiple HTTPS virtual hosts in the Apache environment? The principles used are the same one, that is SNI. A domain-based virtual host, that is, an HTTPS virtual host that shares the same IP address and port.
The sni-server name indicates that it is an extension of TLS that makes it possible to configure SSL-enabled, domain-based virtual hosts. A virtual host that breaks each HTTPS requires an IP address. As a result, costs are greatly reduced because all HTTPS virtual hosts can share the same IP address and port, making HTTPS Web services simpler.
In the Apache environment, you need to use MOD_GNUTLS to configure multiple HTTPS hosts on the same IP. Let's look at the implementation process:
MOD_GNUTLS's web site see: https://mod.gnutls.org
1. Install Mod_gnutls
Copy Code code as follows:
# 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
If you want to install a high version of GNUTLS, you need to first install the corresponding dependent package Libnettle Gmplib. Download Address: http://www.gnutls.org/download.html FTP://FTP.GNUTLS.ORG/GCRYPT/GNUTLS
The Mod_gnutls module relies on Dhfile and rsafile files.
3. Configure httpd.conf
Copy Code code as follows:
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
Create a Reply cache directory
Copy Code code as follows:
# mkdir-m 0700/var/cache/mod_gnutls_cache
# chown Nobody.nobody/var/cache/mod_gnutls_cache
4. Configure the virtual host
Copy Code code as follows:
<virtualhost 10.1.1.22:443>
ServerName www.jb51.net:443
Gnutlsenable on
Gnutlscertificatefile./ssl/www.jb51.net.public.cer
Gnutlskeyfile./ssl/www.jb51.net.private.key
DocumentRoot "/data/wwwroot/www.jb51.net/webroot"
</VirtualHost>
<virtualhost 10.1.1.22:443>
ServerName www.jb51.net:443
Gnutlsenable on
Gnutlscertificatefile./ssl/www.jb51.net.public.cer
Gnutlskeyfile./ssl/www.jb51.net.private.key
DocumentRoot "/data/wwwroot/www.jb51.net/webroot"
</VirtualHost>
It is normal to access each virtual host.