Hey everyone, first, I want to apologize to anyone who felt I was ‘promoting’ anything. I was just pasting from my site and wasn’t trying to flaunt my website or anything similar - just doing things quickly and not thinking about how those links would be perceived. So to recap:
My goal was to have domain[dot]com, domain[dot]co[dot]uk, domain[dot]co[dot]nz, etc, all resolve to the same WordPress instance. Normally, this is pretty easy to setup - I just add block entries that specify the domains, install letsencrpt and cerbot, then certbot finds the block entries and creates SSL certs for each of the domains and places them all in the same certificate directory. The problem is that when you create a domain with EE, it creates empty directories in anticipation of another Wordpress instance. In my case, I only want to have the one instance which all of the domains resolve to. When you EE install LetsEncrypt, it adds an ssl.conf file for each site you’ve added in the empty directory without WP (/var/www/ayrne.co.nz/conf/nginx/ssl.conf, for example) and places the cert as if it’s going to be pulled by a separate site in a separate directory. It also creates entries for each site in sites-enabled and redirects to them. This breaks resolution to the WP instance I want to resolve to. Also, when I point any of the .conf files in sites-enabled to the root wordpress directory of the actual WordPress instance, it pulls the cert for the .com instead of the .co.uk, or .co.nz (for example). Just wondering if there’s some right way to setup this scenario using EE.
Here’s what I’m running in EE:
- ee site create somesite[dot]co[dot]uk #to create the site without any peripheral apps
- ee site update somesite[dot]co[dot]uk --letsencrypt #to add letsencrypt
The awesome news is - I found the solution! This can be done in a way that’s fairly intuitive, but the big thing is the KIND of site you create with EE. If you create a blank site via ee site create somesite, it will set the conf to resolve to HTML and you’ll get a 403, of course, it’s the same with ee site create somesite --html, but if you create it with:
- ee site create somesite --php
- ee site create somesite --letsencrypt
In short, it was resolving to the active sites root domain, but because ee site create somesite appears to create configuration for HTML, NginX was looking for an index.html and throwing a 403 error. Creating it with config for php fixed the issue immediately and allowed NginX to pull the index.php in the active WP install.
The only thing that needs to be done after creating the site and setting up LE is to point to the root of the actual wordpress instance you want to resolve to from the whateversite.conf in sites-available and everything will work perfectly!
Anyway, thought I’d share that.