Establish an HTTPS-based Web service

Source: Internet
Author: User
Tags install openssl

Install OpenSSL first

[email protected] ~]# Yum install OpenSSL


Building a private CA server

Modifying the OPENSSL.CNF configuration file

[Email protected] ~]# VIM/ETC/PKI/TLS/OPENSSL.CNFDIR=/ETC/PKI/CA

Create a related file

[[email protected] ~]# cd/etc/pki/ca[[email protected] ~]# makdir certs newcerts crl[[email protected] ~]# touch index.tx T[[email protected] ~]# echo > serial

Generate a pair of keys

[[Email protected] ~]# (umask 077; OpenSSL genrsa-out Private/cakey.pem 2048)

Generate self-signed certificates

[email protected] ~]# OpenSSL req-x509-new-key private/cakey.pem-out cacert.pem-days 3650

Above CA Server Setup completed


The Web server's HTTPS is built as follows

For example, generate a key for the HTTP service

[[Email protected] ~]# (umask 077; OpenSSL genrsa http.key 1024)

Generate a certificate issuance request

[email protected] ~]# OpenSSL req-new-key http.key-out HTTP.CSR

Pass this request file (HTTP.CSR) to the CA server

Then have the CA server sign this certificate

[email protected] ~]# OpenSSL ca-in http.csr-out http.crt-days [number]

The CA server then sends the signed certificate to the client.


Configure Apache to enable SSL-related modules and SSL configuration files

[Email protected] apache~]# vim conf/httpd.confinclude conf/extra/httpd-ssl.conf

Modify the httpd-ssl.conf file, create the associated virtual host, and turn on the SSL feature, specifying the sslcertificatefile certificate file path and the Sslcertificatkeyfile key file path. Restart the HTTP service to see if 443 ports are listening.

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.