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
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 browserhttps://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 thephp trainingcolumn!
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!