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 MoreMonitoring 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 MoreMigrating 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 MoreNginx 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 MoreAutomated 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 MoreWordPress 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 MoreObject Caching, Page Caching, and Other Speed Optimizations On Ubuntu 22.04
In the previous step, I walked you through the process of configuring Nginx to serve your WordPress sites over HTTPS on your Linux server. However, we need to do more if we want our sites to feel snappy. In this step I will guide you through the process of caching a WordPress site. Caching will increase throughput […]
Read MoreConfiguring Nginx to Serve Your WordPress Site Over HTTPS on Ubuntu 22.04
In the previous step, I showed you how to install Nginx, PHP 8.0, WP-CLI, and MySQL, which formed the foundations of a working Linux web server. In this step, I will guide you through the process of deploying your first HTTPS enabled WordPress site with HTTP/2 support. HTTP/2 HTTP/2 is the latest version of the HTTP […]
Read MoreInstall 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 MoreSet 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