Remove empty line in VSCode

To remove empty lines in Visual Studio Code, you can use the built-in “Find and Replace” feature with a regular expression: This remove all empty lines from the file. The regular expression ^\s*$\n matches any line that contains only whitespace characters (spaces, tabs, etc.) and a line break. The ^ character matches the beginning of a line, \s* matches any amount […]

Read More

Monitoring and Ongoing Maintenance

So you’ve followed our in-depth guide and built yourself a shiny new server that’s secure and tuned for optimal WordPress performance, but what’s next? In this step I’m going to outline a few tasks that should be carried out on a regular basis to ensure that your server continues to run securely and perform well. We’ll look […]

Read More

Migrating WordPress to a New Server

In the previous step we enhanced security and performance with tweaks to the Nginx configuration. In this article, I’m going to walk you through the steps required to migrate an existing WordPress site to a new server. There can be lots of reasons to migrate a site. Perhaps you’re moving from one web host to another. […]

Read More

Nginx Security Hardening

In step 3 you learned how to add HTTPS sites to your server, but there is more we can do to improve HTTPS performance and security. We’ll also look at how we can minimize the risks from other types of attacks, such as XSS, Clickjacking, and MIME sniffing. SSL Hardening Although your site is configured to only […]

Read More

Automated Backups to Amazon S3

In the previous chapter, I walked you through how to configure a WordPress server-level cron and set up outgoing email for your Ubuntu server. In this chapter, we’ll look at configuring automatic backups for your sites. Performing backups on a regular basis is essential. It’s inevitable that at some point in the future you will need to […]

Read More

WordPress Cron and Email Sending

In the previous step, I walked you through WordPress caching. In this step I will demonstrate how to configure WordPress cron and set up outgoing email. Cron WordPress has built-in support for scheduled tasks, which allows certain processes to be performed in the background at designated times. Out-of-the-box WordPress performs the following scheduled tasks: However, the […]

Read More

Install Nginx, PHP, WP-CLI, and MySQL on Ubuntu 22.04

In Step 1 of this series, I took you through the initial steps of setting up and securing a virtual server on Ubuntu 22.04. In this chapter I will guide you through the process of setting up Nginx, PHP-FPM, and MySQL—which on Linux is more commonly known as a LEMP stack—that will form the foundations of a working web […]

Read More

Set Up a Secure Virtual Server on Ubuntu 22.04

Prerequisites If you don’t already have a domain name, you will need to purchase one from a domain name registrar, and have the ability to update your domain’s DNS. We highly recommend using Cloudflare’s DNS service for this purpose. Creating a New DigitalOcean Droplet for Your Web Server In this tutorial I’m not going to go into detail on […]

Read More