Use the MOD_GNUTLS module in Apache to implement multiple SSL site configurations (virtual hosts for multiple HTTPS protocols) _linux

Source: Internet
Author: User
Tags bz2 web services

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.