William's Blog

Setting Up WordPress with VPS.

I am in the process of setting up a VPS with multiple WordPress installations, not one installation with WordPress multi-site. I chose Vultr to host the VPS. I started with their Intel high-frequency offering with 1 vCPU, 2 GB RAM, 2 TB transfer, and 64 GB NVME storage. I’ll upgrade later but it is more than enough for the testing phases.

I installed Ubuntu 22.04 LTS on the VPS. I then hardened the server by adding a user with sudo, allowed only SSH authentication, and no root logins. I configured the unattended-upgrades to make sure that the system would stay patched, and set up Vultr to make daily backups of the VPS. I also ran apt update and upgrade to make sure everything was up to date.

Once Ubuntu was set up, I used Hestia Control Panel to setup and maintain the system. Use the provided installation script wizard to customize your install. Keep in mind that Hestia, by default, will install a Nginx/PHP-FPM/Apache2 monster that is pretty atypical. I highly recommend not installing Apache so you can stick with Nginx/PHP-FPM, which offers FastCGI. When you are setting up the admin user for the first time for the control panel domain, enable FastCGI under the Advanced Options button as seen below.

You will need to set up a new user account to set up more domains. I recommend enable TOTP two-factor authentication for each account. However, server configuration can only be performed via the admin account. Click the gear cog as shown below to access the provided controls.

When setting up domains, Hestia will take care of Lets Encrypt. If you want to use WordPress, then choose the WordPress template from the Advanced Options drop-down, enable Fast CGI cache, and choose the PHP version you want to use. I chose PHP 8.1 because I love risk. Click save. Then go back to the domain’s Hestia settings, and Quick Install WordPress.

By the way, I keep my domains on CloudFlare. The DNS updates really quickly, and of course, they also proxy your websites for free. CloudFlare also has an API that works with WordPress plugins, including LiteSpeed Cache for WordPress.

Once you set up WordPress, I recommend installing and configuring Two Factor, All-in-One Security, and LiteSpeed, and SMTP2GO. SMTP2GO is a mailing service that typically handles large scale mail. However, you can also use it to send service messages from WordPress and Hestia. You have to confirm a sender domain or an individual sender. SMTP2GO will send the mail as coming from that domain or the sender. Set up service with SMTP2Go (with a very healthy free tier), and then set up an API Key with these permissions:

Plug the API Key into the SMTP2Go WordPress plug-in, and it should work like magic.

I’ll be honest. Setting up LiteSpeed Cache for WordPress is a pain and will take your website down for a half-hour during setting up the CDN. With that out of the way, first install Redis and Redis PHP. I used this tutorial. You will also need an account with QUIC.cloud and link the plug-in with the service. QUIC.cloud has a very health free tier. The standard paid service is pay as you go, not monthly, which is very fair. Each month, the standard service gives you a certain number of free credits. Once you exceed the limit, then it will deduct points from your balance.

Quic.cloud has a CDN, and optimizes your website’s images to make them load faster to make Google PageSpeed happy. You will need to delete the A records for your domain and www, and replace them with CNAME records pointing to QUIC. Your DNS registrar must be able to flatten CNAME records. I highly recommend Cloudflare because it will update super-fast, and flattens CNAME records. Wait for Quic.cloud to verify the domain settings, and wait another fifteen minutes for them to set up a Let’s Encrypt SSL certificate for your domain.

Once LiteSpeed is set up and connected to QUIC.cloud, then activate the Object Cache Settings. Make sure that Redis and Redis PHP are installed as above. Make sure that you set the Port to 6379 for Redis, that the Redis Extension is enable, and that the Connection Test passes as shown below.

I would recommend very cautious settings. I basically minified the CSS/JS/HTML, losslessly optimized the images, and set Font Display Optimization to SWAP. There are many options and settings to configure. Learn about each setting before setting it up. Again, I took a very cautious approach. I also set up a Cloudflare API key and plugged that in.

I also installed Bricks Builder. It is a very powerful tool but there’s a huge learning curve. Take the time to learn about the basics and setting up the theme before starting. I would recommend Elementor if you want something easier to use but keep in mind that the website generated by Elementor is sluggish compared to that made by Bricks Builder. Bricks Builder also has a $200 lifetime license promotion, which I bought. Not really sure if that’s a good idea but I like them, and I want them to stick around.

Overall, the system is really fast. With the object cache provided by Redis and the page cache with Fast CGI, the system is getting 95%+ on PageSpeed on mobile. So far, the system has been pretty solid. I rebooted the server a few times to make sure that it comes back up correctly, and it did.

Anyway, bottom line: I recommend Hestia Control Panel (without Apache!), LiteSpeed Cache, and SMTP2Go. That’s probably the best way to set up a LAMP stack on a VPS. Closing words: set up two-factor authentication whenever possible.

P.S. Disappointingly, this post only gets 85% on PageSpeed mobile. =(