Configuring HTTPS services on a centos system

Source: Internet
Author: User

Configuring HTTPS in CentOS6.9 (http2.2)

Configuration is implemented in CentOS6.9 and CentOS7 respectively

Configuring HTTPS in CentOS6.9 (http2.2)

Prepare before creating:

Installing OPENSSSL packages and http2.2

1. Create a private CA on the host (192.168.109.100)

(1) Get the private key

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191124_17343.png "/>

Note: 1, the private key save path is according to the/ETC/PKI/TLS/OPENSSL.CNF configuration file is defined as/etc/pki/ca/private/

2. The right of the private key to be made must be

3. The file name must end with a. PEM

(2) Making self-visa

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191218_97518.png "/>

Note: 1, since the visa book path according to the/ETC/PKI/TLS/OPENSSL.CNF configuration file is defined as/etc/pki/ca/

2. The file name must end with a. PEM

3, the-x509 option can only be used when they issued their own certification

then your host is the CA.

(3) Provide the required directories and files for the CA

~]# Mkdir-pv/etc/pki/ca/{certs,crl,newcerts} (if none of these files are created, if any)

~]# Touch/etc/pki/ca/{serial,index.txt}

~]# echo >/etc/pki/ca/serial

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191247_39010.png "/>

2, in the host (192.168.109.103) do HTTPS

Create a virtual host

Because it's http2.2.

Need to shut down the hub server first

Note (dedicated to httpd-2.2): The general virtual machine should not be mixed with the central host, therefore, to use the virtual host, you must first disable the ' main ' host;

Disable method : Note the documentroot instruction of the central host;


(1) Create a virtual host and install the Mod_ssl module

Installation module:

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191356_37549.png "/>

Vim/etc/httpd/conf.d/vir1.conf

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191412_94383.png "/>

(2) switch to/etc/httpd/ssl directory

Mkdir/etc/httpd/ssl

Cd/etc/httpd/ssl

(3) Get the private key

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191430_64611.png "/>

(4) Generate Certificate signing request

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191444_18510.png "/>

(5) Send request to CA

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191458_48017.png "/>

(6) CA Visa

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191519_62429.png "/>

(7) CA sends certificate to customer

SCP/ETC/PKI/CA/CERTS/HTTP.CRT [email protected]:/etc/httpd/ssl

(8) Modifying the SSL configuration file

Vim/etc/httpd//conf.d/ssl.conf

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191537_46558.png "/>

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191552_80761.png "/>

(9) Detection syntax and restart service

Httpd-t

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191610_53205.png "/>

(10) Import the CA certificate into the client browser

(11) test

Enter url:https://www.lyy.com with a Web browser

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604191622_23419.png "/>

Test success

CentOS7 (http2.4) on the configuration HTTPS

I. Installation of HTTPD and MOD_SSL services

Yum Intall httpd mod_ssl

This host ip:192.168.109.106

Second, create a virtual host and obtain a CA certificate

1, vim/etc/httpd/conf.d/vir1.conf

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192405_45675.png "/>

2. Obtain the certificate (in host 192.168.109.103 private CA Authority)

(1) Switch to/etc/httpd/ssl directory

Mkdir/etc/httpd/ssl

Cd/etc/httpd/ssl

(2) Get the private key

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192418_26865.png "/>

(3) Generate certificate signing request

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192435_46313.png "/>

(4) Send request to CA

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192446_71382.png "/>

(5) CA Visa

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192500_74214.png "/>

(6) CA sends certificate to local host (192.168.109.106)

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192521_81758.png "/>

(7) Syntax detection and restart service

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192532_58593.png "/>

Third, testing

1. Import the certificate into the client browser

2. Visit https://www.zq.com

650) this.width=650; "src=" Http://www.178linux.com/wp-content/uploads/2017/06/20170604192546_24315.png "/>

Configuration succeeded




This article is from the "11952324" blog, please be sure to keep this source http://11962324.blog.51cto.com/11952324/1934301

Configuring HTTPS services on a centos system

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.