Record the process of adding SSL (https) to the website server once
It is said that HTTPS is better and safer now, and HTTPS is also added to your website to record this process.
Try accessing http://andaily.com.
-Hardware environment
Operating System: Ubuntu 12.04.1 LTS
Server: Apache Server 2.2.22
SSL Certificate: waotong free SSL Certificate G2 (Application address: https://buy.wosign.com/applyforssl.htmlselect the first free SSL Certificate)
-Main Steps
1. After applying for free SSL, the SSL Certificate will be downloaded. There are three Apache certificate files: 1_root_bundle.crt; 2_xxx.crt; 3_xxx.key. (xxx is the domain name at the time of application, the same below)
Copy the three files to any location on the server (it is recommended to put them in the/etc/apache2/ssl/directory)
2. Enable the SSL module and use the command
a2enmod ssl
3. In the/etc/apache2 directory, copy sites-available/default-ssl to the sites-enabled directory and change its name to 001-ssl.
Edit the-SSL file and add the following content under SSLEngine on.
SSLCertificateFile /etc/apache2/ssl/2_xxx.crt SSLCertificateKeyFile /etc/apache2/ssl/3_xxx.key
SSLCACertificateFile /etc/apache2/ssl/1_root_bundle.crt
Save and exit.
4. Reload Apache configuration and restart Apache
/etc/init.d/apache2 force-reload
/etc/init.d/apache2 restart
OK. Now your website supports https access (http access is also available)
If the website needs to Use https forcibly (http is no longer supported, it will be forcibly redirected to https during http access), the configuration is as follows:
In the/etc/apache2 directory, edit the sites-available/default file. Add the following content
# Force HTTPS RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]
This configuration redirects all http requests to https.
OK. I hope it will help you.