Om du har satt upp en snabb och säker server för WordPress via Wordops så är det dags för steg två: Att installera WordPress. Fem minuter och två kommandon är allt du behöver.
Den här guiden fanns på codecoffee.com/optimal-wordpress-setup-with-wordops-caching/. Tyvärr har sajten tagits bort, men innehållet är så pass bra att jag tycker fler kan få ta del av det. Jag har själv följt guiden – denna del till punkt och pricka – och har därför en WordPress som snurrar bra, med minimalt underhåll och såvitt jag känner till ska den vara tillräckligt säker. Inga synliga/kända intrång – men jag ser att många försöker…
Med det sagt; fråga gärna om du undrar något.
Optimal WordPress Setup with WordOps & Caching
If you followed my server setup guide then your new server should be secure and ready for WordOps and WordPress to be installed.
Before we dive into the steps though, what is WordOps exactly?
WordOps toolset for your server that lets you deploy and manage WordPress installations (i.e. sites) that are secure, optimized and blazing fast. It will install Nginx (you can read all about that here) and configure it correctly for you. Nginx is your web serving software that will actually deliver/serve/show your website to your visitors.
WordOps also installs MariaDB which is where all your posts (well, the text anyway) will be stored – it’s a database based on MySQL, which you may have heard of.
Finally, WordOps also installs and automatically sets up multiple cache backends (more on caching here) and will let you easily obtain an SSL certificate for your domain (see the padlock next to ”codecoffee.com” in your browser address bar?) which means that all data exchanged between you and the website is encrypted.
On top of this, WordOps can also install a bunch of optional software (server monitoring, firewalls, etc).
By now you must be thinking that all this sounds complicated right? I am not going to lie and will admit that the underlying software is, however WordOps makes it incredibly easy to setup and use – you can be up and running with just one or two commands (which are themselves very intuitive) in as little as five minutes.
Read on and see what I mean.
Where we’d left in my previous guide you had just finished defining the default root email and were otherwise all secure and ready to go. So let’s install WordOps now. Just enter the following in your shell prompt:
wget -qO wo wops.cc && sudo bash wo
You’ll need to enter your name and email during the installation. The name will become the default admin username for the WordPress sites you create and the email will be the default admin email.
Other than that, you’re done! It really is that easy. So, let’s make a WordPress site.
Create Your WordPress Site
For the purposes of this example let’s assume that your website will be located at www.codecoffee.com. I’m also going to assume that you’ve already pointed your domain to the server (if you haven’t, see this guide). Now to setup your WordPress site all you need to type is the following:
wo site create codecoffee.com --wpredis --php73 -le
Eftersom jag installerat Ubuntu 20.04 så ingick PHP7.4, jag hade dessutom inte pekat om domänen till servern ännu, så Let’s Encrypt krånglade lite, men det löste jag med detta kommando
wo site create codecoffee.com --wpredis --php74 -le --force
As you can see, everything required has been installed and configured for you automatically. You can ignore the message in yellow and red at the bottom of the image by the way – that was simply because the domain I was using in this example, codecoffee.com, is already in use for this website and is pointing to this server, not the demo server. Provided that when you do this for creating your websites, you have successfully set the DNS for your domain, you will be fine.
You can now go ahead and access your brand new WordPress site using the details you see here from the output:
WordPress admin user : XXXX WordPress admin password : XXXX
Put a ”/wp-admin/” onto the end of your domain, so that it would become codecoffee.com/wp-admin/ for example, and paste that into a browser. You should get a prompt asking you to login as below. Simply enter your admin username and password and you’re in!
Change WordOps Tools Port
There’s one last thing to do. Head back here and remind yourself about the following lines:
# Allow incoming WordOps Tools -A INPUT -p tcp --dport 31837 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -p tcp --sport 31837 -m state --state ESTABLISHED -j ACCEPT # Allow outgoing WordOps Tools -A OUTPUT -p tcp --dport 31837 -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -p tcp --sport 31837 -m state --state ESTABLISHED -j ACCEPT
WordOps comes with a suite of tools, some of which we might want to use at a later stage (like phpMyAdmin, which lets you edit databases in a graphical user interface (GUI)). The default port of WordOps tools is 22222, we are going to change that to the port we opened in our Iptables firewall though. In the example above, that port is 31837. Run these commands:
wo secure --port 31837
wo secure --auth
The first command changes the port that we use to access the tools, the second changes the username and password that we’ll need to enter. If you want to take a look now, you can head to https://:31837/ or https://:31837/ using your browser and login. There won’t be much to see just now though – we’ll run over the different tools that are available within WordOps in another article.
For now, since you are up and running, just make sure that you follow my weekly server maintenance routine.