-
Notifications
You must be signed in to change notification settings - Fork 66
How to configure multiple WordPress sites on a single server
- A note about server security
- Editing your hosts file
- Creating a new customization file
- Copying secrets
- Configuring your new WordPress site
There might come a time where you want to configure multiple WordPress sites on the same server. This can be useful in scenarios where you have small WordPress sites with little traffic. This guide will show you how you can configure multiple WordPress sites on the same server using DebOps.
This guide assumes that you're familiar with how to customize your server. If you don't know how or aren't sure, take a moment to go over this guide first.
One of the important aspects of the DebOps project is security. It wants your server to be as secure as it can be. With that in mind, it's important to know that implementing what's in this guide will reduce the overall security of your server.
Running multiple WordPress sites on a single server isn't as secure as running a single one. This is how you can end up with a soup kitchen server. That said, this guide will walk you through all the necessary steps for ensuring that your server stays as secure as it can be.
The first step is to edit our project's host
file that you saw in "Configuring your server". Let's imagine that you already have your first WordPress site configured for wordpress.example.com
. Now, you want to add a test site to the same server at the address wordpress_test.example.com
like this:
# inventory/hosts
[debops_all_hosts]
wordpress_test.example.com
wordpress.example.com
[wordpress]
wordpress_test.example.com
wordpress.example.com
You can find your hosts
file in inventory
directory of your project. As you can see, we added wordpress_test.example.com
under both [debops_all_hosts]
and [wordpress]
. You also need to ensure that you updated your DNS to point wordpress_test.example.com
to IP of your existing server.
Right now, you should only have a single vars.yml
customization file in inventory/host_vars/wordpress.example.com
. You're going to create a new vars.yml
customization file for wordpress_test.example.com
. You'll need to create it in the inventory/host_vars/wordpress.example.com
directory and ensure that it contains the following:
wordpress__database_name: 'wordpress_test'
wordpress__user_name: 'wordpress_test'
The vars.yml
customization file contains two options: wordpress__database_name
and wordpress__user_name
. wordpress__database_name
is the name of the database that wordpress_test.example.com
will use. wordpress__database_name
can't be the same value as the vars.yml
customization file from wordpress.example.com
.
wordpress__user_name
is the name of the system user used by wordpress_test.example.com
. You also want this option to have a different value than the one for wordpress.example.com
. This is option is critical for maximizing the security of your server.
DebOps keeps a copy of all your server passwords in the secret
folder at the root of your project. Because DebOps already configured your database server, you need to copy the root
password for the database. That way DebOps will be able to configure the database of your new server.
You'll find the original root
password for wordpress.example.com
in the password
file in the secret/credentials/wordpress.example.com/mariadb/localhost/root
folder. You need to create the same password
for wordpress_test.example.com
. But the file needs to be in the secret/credentials/wordpress_test.example.com/mariadb/localhost/root
folder. You'll have to create the folder yourself before configuring the server.
At this point, the only thing left to do is to configure your new WordPress site. This means running the DebOps playbook for wordpress_test.example.com
. You can do this by using this command:
$ debops wordpress --limit wordpress_test.example.com
Getting Started
Adjusting performance
Cookbook
- How to configure a server for a Bedrock project
- How to configure multiple WordPress sites on a single server
- How to configure Varnish
- How to create a multisite network
- How to customize your server
- How to manage additional users
- How to manage WordPress plugins
- How to secure your WordPress site
Troubleshooting
Appendix