How to configure and Install SSL Certificate for Multisite Wordpress?

May 12, 2018 90 views
Apache WordPress Ubuntu

I have a droplet with multiple wordpress instances running? I would like to install SSL certificate for one of the domain? Example I have www.site1.com and www.site2.com running on the same droplet.

I would like to have Site1.com moved to https://www.site1.com, while site2.com will remain as non-SSL. The ssl certificate is from godaddy.

I have update the .htaccess to use
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://site1.coml/$1 [R,L]
</IfModule>

also when I install and change the site1.com.conf file in sites-available , the site2.com is not loading. without installing SSL, both site1.com and site2.com are working fine.

Kindly Help?

1 Answer

You will likely want to create 3 VirtualHost configurations in /etc/apache2/sites-enabled

  1. This will be the name based virtualhost for site2.com and will be set up fairly standard but ensuring that AllowOverride All is set to enable Apache to use WordPress' .htaccess files.

  2. This will be another port 80 http definition which will point to site2.com's directory. Since you are using an .htaccess redirect this can also be fairly standard since we can expect anyone hitting this virtualhost will be redirected to the https version via the .htaccess file.

  3. This third virtualhost will be IP based rather than name based and will listen on port 443. This is where you will configure your certificates. This virtualhost should be pointed to the directory for site1.com

Here are a few guides that will be helpful in setting this up:

This tutorial will show you how to acquire and install an SSL certificate from a trusted, commercial Certificate Authority (CA). SSL certificates allow web servers to encrypt their traffic, and also offer a mechanism to validate server identities to their visitors. The...
Have another answer? Share your knowledge.