Non-WordPress MultiSite, Part 1: Server

This is the first in a series of posts about setting up your own WordPress server. The end goal is to host multiple blogs on one server; for example, this blog is ‘tech’ and I’m planning another one, ‘cook’ which I want to also run from this server. This is known as WordPress MultiSite; specifically, I wanted to do a non-WordPress multisite, which has some other considerations for the server. To begin we will take a look at installing Linux, from the OS to the software needed to run and serve WordPress.

Before we begin, you might like to know a bit about the setup I have at home. I’ll be explaining my home networking setup in a future post, so stay tuned!

UPDATE: Here it is!

Special thanks to Tony Teaches Tech for assisting with their YouTube videos! Specifically, this video is relevant to this post.

This post is broken up into the following sections:

  1. OS Considerations
  2. OS Installation
  3. Software Selection
  4. Software Installation
  5. Testing the Setup!


OS Considerations

There are a few different things to consider when choosing an OS for your server. Should you choose Windows or Linux? What about Mac?

The truth is most of this is just preference and familiarity; you might already know that much of the Web is run on Linux, and that is what we will be using here. Plus, it is free and highly configurable!

Now, which Linux? A quick Google search turns up many, many results. For a server, you might find Fedora Server, Ubuntu Server, or Debian. You even might have previously used CentOS. For this use case, I chose Rocky Linux, which is a spiritual (if not direct) descendant of CentOS.

Now that we have our Linux OS, we can install it and the software we need.


OS Installation

I am not going to go into much detail here for the OS installation. There are many people that have put in a lot of effort to explain how to install Linux OS’s before. I will, however, detail one thing that I like to do that some may gloss over.

In the Rocky Linux installer, for the Installation Destination, I choose Custom. In the resulting screen, I change the type of partition to Primary, then I click the link to create the necessary partitions. After that, I click the root ( / ) partition and I change the size to fill the disk; it will auto-update to the remaining space after you click to update the change. Again, this is more of a personal preference; a lot of successful installations don’t mess with any of that.


Software Selection

The software we need to install (other than Linux) is a web server, a database, and to extend the web server to allow PHP code execution. Colloquially, this is known as a LAMP or LEMP server, depending on the software you choose (A is for Apache, and E is for Nginx – more on those in a sec). Both are viable options for setting up a non-Wordpress MultiSite.

For the web server, there are two mainstream choices – Apache or Nginx. Apache is the older software, and Nginx is newer. There are pros and cons to both. For this project I chose Apache.

For the database, there are two choices here as well. MySQL is currently developed by Oracle, and MariaDB is a fork of that code base. In general terms, the difference between them is licensing – MariaDB is free and open-source. I chose MariaDB for this server.

For PHP, there is only one choice – whether or not to utilize PHP-FPM. From what I have read, PHP-FPM allows faster page loading, so I chose to use it.


Software Installation

Now for the fun part! Let’s install the needed components and move on to test the setup. If you decided to go with Fedora Server, these commands would be the same; if you used Debian or Ubuntu, you would use the apt command instead.

First, you should ensure that all the software on the system is up-to-date:

Console

sudo dnf update

Then, we need to issue the command to install the software.

Console

sudo dnf install httpd php mariadb-server

There are a few configuration steps we need to take to make sure everything is on and working. We need to enable the services for the server, and we need to start them up; then we need to open the http and https ports in the firewall and reload.

Console
# enable the services
sudo systemctl enable httpd php-fpm mariadb-server

# start the services
sudo systemctl start httpd php-fpm mariadb-server

# open http and https ports
sudo firewall-cmd --permanent --add-service http --add-service https
sudo firewall-cmd --reload

And that’s all! Now we can test everything!


Testing the Setup!

Now we can test our initial configuration of the non-WordPress MultiSite. The first step is making sure that the web server is set up.

Apache

If the server you are working on has had a desktop installed, you can open up a browser and navigate to http://localhost and you should see a page similar to the one above. If you are accessing a remote server (or a local one, without a desktop), then you can browse to its IP address. This test ensures that the Apache component of the server is working correctly.

PHP

Now, we need to ensure that PHP is working. For this, the easiest thing to do is to write a simple PHP file and serve it in place of this page.

On Rocky Linux, the index page is located in the shared user folder:
/usr/share/httpd/no-index/index.html

Let’s write a simple PHP file in the same directory:

Console

echo '<?php echo "The time is " . date("h:i:sa"); ?>' | \
sudo tee /usr/share/httpd/no-index/index.php

We also have to edit one of the server files to point to our new PHP file. I use the vi editor to edit files:

Console

vi /etc/httpd/conf.d/welcome.conf

Change the following line:

/etc/httpd/conf.d/welcome.conf

#<-- before
Alias /.noindex.html /usr/share/httpd/noindex/index.html

#--> after
Alias /.noindex.html /usr/share/httpd/noindex/index.php

Now, we can navigate to the homepage again and we should see this:

MySQL

And the last thing to check is that the MySQL server is functioning properly. Let’s try to connect to it:

Console

sudo mysql

If it is working correctly, you should see this:

Console
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2946
Server version: 10.5.16-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

From here, you can type quit; and you will exit back to the shell. You may also want to run the command sudo mysql_secure_installation and read and follow the prompts to assist in securing the database.

And that’s it! The server itself is ready to host a PHP based website, and we have a database available to power it. This is perfect for creating our non-WordPress MultiSite! Next, we will take a look at getting the latest WordPress release and getting it installed.


Posted

in

, , , , , , , , ,

by

Comments

2 responses to “Non-WordPress MultiSite, Part 1: Server”

  1. Anon Avatar
    Anon

    Nice post. I was hoping for more technical details on the installation of the OS – do you have plans to write something about that?

    1. The Tech Trotter Avatar

      Yes, especially because I have a bit of a different way with the storage. Keep an eye out!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.