Home  >  Article  >  Backend Development  >  Simple implementation of HTTPS and automatic implementation of ssl

Simple implementation of HTTPS and automatic implementation of ssl

coldplay.xixi
coldplay.xixiforward
2020-09-02 17:35:262562browse

Simple implementation of HTTPS and automatic implementation of ssl

It is well known that the HTTP protocol is an insecure protocol, and the HTTPS protocol is the abbreviation of HTTP over SSL/TLS, which means "HTTP using SSL/TLS, which is usually The so-called "Hypertext Transfer Security Protocol". HTTP combined with SSL/TLS protocol can build a network protocol for encrypted transmission and identity authentication.

The webpage before upgrading to HTTPS is as follows

Configure HTTPS

The default port of HTTPS is 443, permanently add this port number to the firewall whitelist.

sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
sudo firewall-cmd --reload

View open ports

sudo firewall-cmd --list-port80/tcp 443/tcp

Install the SSL module

sudo yum -y install mod_ssl

After the installation is completed, generate the ssl configuration file in the Apache configuration directory

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

The corresponding private key can be seen from the above figure and the certificate is placed in

/etc/pki/tls/private/localhost.key/etc/pki/tls/certs/localhost.crt

Restart the Apache service

sudo systemctl restart httpd

Visit in the browser https://lamp.test.com

Click on the red warning sign and find that the certificate is only valid for one year.

Since then, HTTPS has been implemented by automatically installing the ssl module.

Want to know more For programming learning, please pay attention to the php training column!

The above is the detailed content of Simple implementation of HTTPS and automatic implementation of ssl. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.im. If there is any infringement, please contact admin@php.cn delete