Deploying HTTPS on CentOS7

At present, many browsers have strengthened the security of HTML and require the configuration of HTTPS.

The following example is the Apache configuration HTTPS process on CentOS7.

First, generate certificates.

Using OpenSSL to generate key and certificates:

mkdir /etc/ssl/private
chmod 700 /etc/ssl/private
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

Two. Install and configure SSL module.

yumInstallation module

yum install mod_ssl
vim /etc/httpd/conf.d/ssl.conf

The following contents are changed in the configuration file:

DocumentRoot "/var/www/html"
ServerName www.xxx.net.cn:443

SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

Inspection configuration:

apachectl configtest

Three, restart service

systemctl restart httpd

So Apache has HTTPS service.

 

Leave a Reply

Your email address will not be published. Required fields are marked *