Get the certificate
openssl generates SSL certificate (self-Baidu) (Recommended learning: apache use)
Tencent Cloud, Alibaba Cloud, Baidu Cloud, etc. all provide free SSL certificates
Certificate installation
Edit the Apache root directory Download the conf/httpd.conf file, find #LoadModule ssl_module/mod_ssl.so and #Include conf/extra/httpd-ssl.conf, remove the # comment in front;
Edit Apache and directory conf/extra/httpd-ssl.conf file, modify the following content:
<VirtualHost *:443> DocumentRoot "/var/www/html" ServerName www.domain.com:443 SSLEngine on SSLCertificateFile /usr/local/apache/conf/2_www.domain.com_cert.crt SSLCertificateKeyFile /usr/local/apache/conf/3_www.domain.com.key SSLCertificateChainFile /usr/local/apache/conf/1_root_bundle.crt </VirtualHost>
After the configuration is completed, restart Apache and you can access it using https://www.domain.com.
Note:
The above is the detailed content of How to configure https in apache2.4. For more information, please follow other related articles on the PHP Chinese website!