Setting up WordPress Multisite with SSL on DreamHost

TL:DR; Setup the extra domains as “fully hosted”, but set the web root to the same directory as the root domain, then re-save SSL settings (if applicable).


With most hosts, when you want to setup a WordPress Multisite installation, you just create a normal site for the primary domain, and the create domain aliases for each additional site. With DreamHost, though, it’s a bit more complicated.

If you setup a domain alias — a “mirror” in DreamHost’s jargon — that’ll work for HTTP, but fail for HTTPS; you’ll get a Site Not Found error.

Instead, it turns out that you need to setup each extra domain as “fully hosted”, but then set the document root (“web directory”) to be equal to the document root of the primary domain.

Troubleshooting and Other DreamHost Quirks

HTTPS

If you’re still having problems after trying the above solution, and you’re also using SSL certificates, then you may need to go to the Manage Domains > HTTPS On section of the DreamHost Panel, make sure the Copy non-secure settings option is checked, and click Edit HTTPS now. That will re-generate the HTTPS virtual host configuration for the domain.

It turns out that the HTTP and HTTPS vhosts aren’t tied together like you’d expect; the HTTPS vhost is independent, so if you change the HTTP vhost’s document root after saving the SSL settings, then HTTPS will continue pulling from the old document root, instead of automatically updating.

Tabbed Browsing

Another frustrating thing that I ran into had to do with tabbed browsing. I use tabs extensively for convenience and productivity, and it seems like, in 2018, it’s universally accepted that they’re a normal part of browsing for most users.

In spite of that, DreamHost’s Panel has a bug where, if you open the hosting settings for two sites in different tabs, and then make changes to the settings in the tab you opened first, those changes will be saved to the tab you opened last. Their code assumes you’re only ever using one tab at a time, and uses some kind of stateful variable to keep track of the current site, rather than just using a hidden form field like you’d traditionally expect.

Custom PHP Config

This one is kind of unrelated, but I might as well document all of my DreamHost quirks in one place :)

If you have any PHP config customization in ~/.php/{version}/phprc, and you also have a site set up to automatically update to DreamHost’s recommended version of PHP, then you should be aware that your custom phprc will not be copied over during the automatic upgrade.

In order to make sure your custom changes aren’t lost when your site upgrades, you’ll need to setup some way of reminding yourself to periodically check the ~/.php folder for new PHP versions, and install your changes before those new versions become the recommended version. I’m planning to write a cron job to email myself when a new version appears.

Directory Browsing

While we’re at it, it’s worth mentioning that for some inexplicable reason, directory browsing is enabled by default, even though their own docs acknowledge the privacy/security risk introduced by that behavior, and that it isn’t what most people want.

Given that, I can’t imagine what possible reason they have for turning it on by default, but apparently they have one. So, to avoid that risk, you’ll need to manually add  Option - Indexes to all of your .htaccess files, and also come up with some kind of way to remind yourself to add them to any new sites you add in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *