How Apache builds HTTPS Virtual Host

Source: Internet
Author: User
Tags install openssl openssl sha1 ssl certificate

1. Create an SSL certificate

First you need to install the Openssl,linux system by default installed, if not installed with the following command:

sudo apt-get install OpenSSL  
sudo apt-get install Libssl-dev

To create a certificate:

Cd/etc/ssl/private  
sudo openssl req-new-x509-days 365-sha1-newkey rsa:1024-nodes-keyout demo.key-out demo.crt

Parameter description:

-x509 Display certificate and signing tool

Validity period of-days certificate

-SHA1 Certificate Encryption algorithm

-newkey rsa:1024 creates a new key,1024 indicating a public key length of 1024bits

Demo.key and DEMO.CRT are created after the command is executed

More parameter description can refer to: http://www.openssl.org/docs/apps/openssl.html

To create a step:

 root@ubuntu:/etc/ssl/private# sudo openssl req-new-x509-days 365-sha1-newkey rsa:1024-nodes-keyout Demo.key- Out DEMO.CRT generating a 1024 bit RSA private key ... ++++++ ... ++++++ writing new private key to ' dem '., ...   
O.key '-----You are about to is asked to enter information that'll be incorporated into your certificate request.  
What you are about to enter the What is called a distinguished Name or a DN. There are quite a few fields but can leave some blank for some fields There would be a default value, If you enter  
'. ', the field would be left blank. -----Country Name (2 letter code) [AU]:CN State or province name (full name) [SOME-STATE]:GD locality name (eg, CIT y) []:gz organization Name (eg, company) [Internet widgits Pty Ltd]:fdipzone. Ltd. organizational unit name (eg, section) []:test Common name (eg, YOUR Name) []:d emo.fdipzone.com Email A ddress []:fdipzone@gmail.com root@ubuntu:/etc/ssl/private# 

Items to be filled in:

Country Name (2 letter code) [AU]: Country

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/

State or province Name (full name) [Some-state]: Province

Locality Name (eg, city) []: Cities

Organization name (eg, company) [Internet Widgits Pty Ltd]: Corporate name

Organizational unit name (eg, section) []: Organizer Name

Common name (eg, YOUR name) []: Fill in the domain name

email address []: email Addresses

2. Create Virtual Host

<virtualhost *:443>  
    documentroot/home/fdipzone/demo  
    ServerName demo.fdipzone.com  
      
    <directory "/home/fdipzone/demo" >  
    allow from all  
    allowoverride all  
    options-indexes followsymlinks  
    </ Directory>  
      
    sslengine on  
    sslcertificatefile/etc/ssl/private/demo.crt  
    sslcertificatekeyfile/etc/ Ssl/private/demo.key  
    Sslciphersuite aes128-sha:high:medium:!anull:! MD5  
    Sslhonorcipherorder on  
</VirtualHost>

Open SSL engine and set the certificate used, port 443

Sslengine on

Sslcertificatefile/etc/ssl/private/demo.crt

Sslcertificatekeyfile/etc/ssl/private/demo.key

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.