Managing your site with WordOps

WordOps is a wonderful tool, specifically made to make hosting WordPress websites easier, although they also provide excellent support for setting up and managing static sites, reverse proxies, and the like. It’s a wonderful tool for managing websites, and I highly recommend you use it.

I want to to take you through the steps necessary to install and configure WordOps, and launching your first WordPress site!

Before you get started

Make sure you have the following available before you start:

  1. A server.
  2. A domain that points to the server; I chose thorlaksson.com.

I’ll be using an Ubuntu 20.04 server with an expandable volume attached where I will host sites, which will require some additional setup.

Mounting the volume for expandable storage

🌟

I’m using Hetzner to host the server, so these instructions will be specific to servers hosted with them. The process should be similar for any other service, but there might be a few differences.

First, delete your /var/www/ directory. If you already have things there you want to keep, make sure you back them up.

cp -r /var/www ~/ # For backup purposes
sudo rm -rf /var/wwwCode language: PHP (php)

Open your fstab file with your favorite editor and mount your volume there.

sudo nano /etc/fstab # to open the file with nano
sudo vi /etc/fstab # to open the file with viCode language: PHP (php)

Add the following line to your fstab, and make sure to change the volume ID.

/dev/disk/by-id/<volume_id> /var/www ext4 discard,nofail,defaults 0 0Code language: HTML, XML (xml)

Your fstab should now look something like this.

# /etc/fstab: static file system information.
UUID=2B0E-1DC7  /boot/efi       vfat    umask=0077      0       1
/dev/disk/by-id/scsi-0HC_Volume_10143990 /var/www ext4 discard,nofail,defaults 0 0Code language: PHP (php)

Now, reboot your server, and ssh back into it.

sudo reboot

Once your server is up again, make sure the /var/www/ directory has the correct ownership setup.

sudo chown -R www-data:www-data /var/wwwCode language: JavaScript (javascript)

And now we’re ready to setup WordOps!

Installing WordOps

To install WordOps use ssh to connect to your server and run the installation command.

wget -qO wo wops.cc && sudo bash woCode language: CSS (css)

This will install WordOps and its dependencies on your system.

💡

Many people are uncomfortable with piping scripts to sudo for a good reason. If you prefer you can clone the repository from git and install it that way:

git clone https://github.com/WordOps/WordOps.git
cd WordOps/
sudo bash installCode language: PHP (php)

WordOps requires super user privileges to manage everything for you, so it’s a good idea to add a command alias to automatically run the wo command with super user privileges.

echo -e "alias wo='sudo -E wo'" >> $HOME/.bashrcCode language: PHP (php)

Now that the wo tool has been installed, we use WordOps to install the technology stack used to run the websites. You can see precisely what will be installed here.

wo stack install

During this installation WordOps will create credentials for the administrative dashboard, but we’ll change those with the next command.

wo secure --auth

You’ll be prompted for a username and password. Generate a strong password with you password manager and save it there.

Remember to enable the firewall too!

wo stack install --ufw

Now, you should be able to look at the admin dashboard at https://<domain>:22222. In my case, that’s https://thorlaksson.com:22222.

The SSL certificate won’t be valid for the admin dashboard, but don’t worry about that; that will be fixed when we create our first site.

Creating your first WordPress site

Now it’s time to setup a WordPress site! 🎉

Run the site create command with a couple extra flags.

wo site create thorlaksson.com --wp --php74 --user=<wp_admin_username> --email=<admin_email> -leCode language: HTML, XML (xml)
  • --wp to setup a WordPress site.
  • --php74 to use PHP 7.4.
  • --user=<wp_admin_username> to choose the admin username we want.
  • --email=<admin_email> to set the email for the WordPress admin user.
  • -le to enable Let’s Encrypt and SSL.

Once that command has wrapped up you should have a WordPress site ready to go, with the username and password to login printed out during the installation.

💡

I recommend you change the admin password immediately when you first login to the WordPress site. Use your password manager to generate something stronger than the password generated by default.

Before we login though, let’s install some essential plugins, with WP CLI — a tool WordOps installed for us! Just make sure to run these commands with sudo or as www-data.

wo site cd thorlaksson.com
cd htdocs
# You should now be in /var/www/<domain>/htdocs

# Now let's install some plugins
wp plugin install akismet --allow-root --activate # To prevent comment spam
wp plugin install gutenberg --allow-root --activate # To use the latest version of Gutenberg
wp plugin install two-factor --allow-root --activate # So we can use 2fa for website accounts
wp plugin install wordpress-seo --allow-root --activate # For SEO

# Fix permissions
sudo chown www-data:www-data wp-content -RCode language: PHP (php)

You can use commands like this to automate the setup of new sites. If you manage multiple sites, or setup new sites on a regular basis, having a script to set everything up for you is an amazing boon.

Of course, you can remove or add plugins here as you like, or simply do this all through the WordPress dashboard.

Finally, let’s make sure everything on the server is up to date. You can run this same command whenever you want to install updates on your server.

wo maintenance

And that’s it! Your WordPress site is now ready at https://<domain>!

Conclusion

WordOps is an extremely versatile tool for website hosting, especially if you’re managing a WordPress site, or even multiple WordPress sites. I personally use this to great effect to set up testing sites at work.

WordOps is also useful for just managing your web server’s reverse proxies or static sites. I didn’t talk about this much here, but refer to the documentation for how to set those up.

Being able to spin up a site quickly without having to worry about managing a web server, keeping dependencies up to date, setting up a database, and securing everything saves so much time.

Finally, you can just focus on managing a website instead of managing a server.


Posted

in

,

by

Comments

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.