Download SSL Certificate
Only look at this blog one or two, three or four steps to install the SSL certificate
1) First upload SSL certificate, I use FileZilla client upload in/root/ssl:
2) Modify Apache configuration file httpd-ssl.conf
My server system is ubuntu, input command Find/-name httpd-ssl.conf, the following results appear:
Here are a few versions of Apache, which one is used.
My solution is to view the Phpinfo, as follows:
Can be seen, the path for apache71, then modify the apache71 in the httpd-ssl.conf, a total of 3 changes.
# DocumentRoot "/usr/local/apache71/htdocs"
documentroot "your site root"
# Sslcertificatefile/usr/ Local/apache71/conf/server.crt "
sslcertificatefile"/root/ssl/certificate.crt "
# Sslcertificatekeyfile "/usr/local/apache71/conf/server.key"
sslcertificatekeyfile "/root/ssl/private.key"
The comment in the code is the original, the next line is the modified value, and then use the service httpd restart to reboot the Apache http forced https
In the site root directory, enter the command Vi. htaccess to write the following code:
Rewriteengine on
rewritecond%{server_port}
rewriterule ^ (. *) $ https://%{http_host}/$1 [r,l]
Code reference to this blog
Finally, you can enter HTTP access to your site's homepage, which will automatically jump to HTTPS.