Report this

What is the reason for this report?

How to setup Virtualhosts properly for Wordpress Multisite from One Click Wordpress setup with Letsencrypt

Posted on November 16, 2017

Wordpress multisite runs great on Digital Ocean’s One Click Wordpress install setup. However problems happen when trying to add Letsencrypt to the installation for each domain the multisite uses. The typical multisite setup uses subdirectories for each subsite. This is done by wordpress and works fine with stock virtual host settings created by the One Click install from Digital Ocean. However, certbot doesn’t like this and expects a virtualhost to be declared/setup in apache for each domain in your Wordpress Multisite site list. After googling, all examples I see don’t use the same language/code examples in the sites-available as Digital Ocean’s one click setup uses. Here’s what Digital Ocean creates with the setup:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =YourDomainNameHere.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

The

RewriteCond %{SERVER_NAME} =YourDomainNameHere.com

is confusing as tutorials on virtualhosts in Ubuntu 16.04 doesn’t cover this code line.

So… for this situation… which is not currently covered in the Letsencrypt or Wordpress tutorials on Digital Ocean… what is the proper way to add in the domains in apache ALL for the same installation folder ( /var/www/html ) so that Letsencrypt Certbot will install additional domain certificates properly?

Help would be most appreciated. thank you.

P.S. Expanding a single certificate is also not recommended for unrelated domains from what I’ve gathered in tutorials.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.