HTTP HTTPS in Apache

Source: Internet
Author: User
Tags ssl certificate
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.