Create an SSL certificate
To create a SSL certificate run the following command and input the requested information.
1
|
|
Edit config and enable HTTPS for Apache
Edit the default ssl config site to at least contain the following
/etc/apache/sites-availiable/default-ssl
1 2 3 4 5 |
|
The site then needs to be enabled along with the ssl capabilities of Apache. The server then needs to be reloaded but I prefer to restart Apache.
1 2 3 |
|
Force Wordpress to use SSL for Admin logins
To get Wordpress to use SSL just for admin sessions and logging in is simple. It is achieved by adding a single line to the wp-config.php file but before the stated line like below. Beware once this option is set connections will use HTTPS port 443 so ensure Apache is configured to listen on this port as well.
/usr/share/wordpress/wp-config.php (on debian systems)
1 2 3 |
|
How to force use of HTTPS in Apache using htaccess
First ensure that in the virtual server allows the use of htaccess files to be read and acted upon. This is achieve by changing the allowoveride setting in the virtual server config from None to All.
1 2 3 4 5 6 |
|
Create a .htaccess file in the directory you would like to force the use of HTTPS in.
1 2 3 |
|