Most WordPress owners know they need to update plugins and themes. Far fewer think about the server those plugins run on. On managed hosting, that’s the host’s job. On a self-managed VPS, it’s yours. And I regularly find servers where WordPress is fully up to date but the operating system hasn’t been patched in two years, running a Linux release that’s past its end of life, with an OpenSSL library full of known vulnerabilities and a kernel that’s never been rebooted. Keeping a WordPress VPS patched is part of owning one.
Keeping a WordPress VPS patched isn’t difficult, but it does need a routine. Automatic security updates handle most of the work. A few things, like kernel reboots, PHP version changes and major OS upgrades, need human attention. This article sets out a practical approach for Ubuntu and Debian servers, which are the most common choices for WordPress.
What needs patching
A typical WordPress server has several layers, each with its own update cycle:
- The operating system: the kernel, system libraries such as OpenSSL and glibc, and core utilities
- The web server: Nginx or Apache
- PHP and its extensions
- The database server: MySQL or MariaDB
- Supporting services: Redis, Fail2ban, Certbot, mail transfer agents
- WordPress core, plugins and themes, managed separately
Security vulnerabilities appear in all of them. A vulnerability in OpenSSL or the SSH server can be just as serious as one in a WordPress plugin, and often more so, because it affects the whole server.
Step 1: Enable unattended security updates
On Ubuntu and Debian, the unattended-upgrades package installs security updates automatically. It’s often installed by default on Ubuntu, but not always enabled or configured well.
The configuration lives in /etc/apt/apt.conf.d/50unattended-upgrades. By default, it installs updates from the security repository only, which is the right choice for most servers. Security updates are designed to fix vulnerabilities without changing behaviour, so they rarely break anything.
A few useful options to review:
Email reports require a working mail setup on the server. If you don’t have one, check the log file at /var/log/unattended-upgrades/ instead.
Confirm it’s working with a dry run:
Step 2: Decide what to do about reboots
Some updates, most importantly kernel updates, only take effect after a reboot. Others, like updates to shared libraries, take effect only when the services using them restart.
On Ubuntu, a file at /var/run/reboot-required appears when a reboot is needed. You can check it in your monitoring or with a quick command:
You have two options:
- Automatic reboots at a quiet time, by setting Automatic-Reboot to true and Automatic-Reboot-Time to something like 04:00. Good for servers where a minute of downtime at night is acceptable.
- Manual reboots during a scheduled maintenance window, after checking what changed. Better for stores or sites where any downtime needs planning.
For a single-server WordPress site, a reboot typically means one or two minutes of unavailability. Pick a time when traffic is lowest, which for an Indian audience might be early morning IST, and for a US audience might be a very different hour.
The needrestart tool, installed by default on recent Ubuntu versions, tells you which services need restarting after library updates and can restart them automatically, which covers many updates without a full reboot.
Step 3: Watch for third-party repositories
Many WordPress servers use third-party repositories, such as Ondřej Surý’s PHP packages, the official Nginx repository or MariaDB’s own repository. By default, unattended-upgrades only covers the distribution’s security repository, so these packages don’t update automatically.
You can add them to the allowed origins in the configuration, but think carefully. Updates from these repositories may include new minor versions with behaviour changes, not just security fixes. Many administrators prefer to update them manually during maintenance, after checking release notes.
Whatever you decide, make sure they are updated regularly. A server with automatic OS security patches but a PHP build that hasn’t been updated in a year still has a gap.
Step 4: A monthly maintenance routine
Automatic updates cover most security fixes. A short monthly session covers the rest:
- Take a snapshot or confirm the latest backup is good.
- Run a full package update:
- Review what’s being updated, especially PHP, the database and the web server.
- Reboot if required.
- Check that the site loads, the admin works, forms submit and, for stores, checkout completes.
- Check service status and logs for errors:
- Check disk space, since old kernels and logs can accumulate.
Thirty minutes a month keeps most servers in good shape.
PHP versions: the bigger decision
Patch updates within a PHP version, like 8.3.12 to 8.3.14, are routine security and bug fixes. Moving between versions, like 8.2 to 8.3, is a bigger change that can break plugins.
Each PHP version receives active support for two years and security fixes for a further period. Running a PHP version that no longer receives security fixes is a real risk, and WordPress itself recommends supported versions.
Plan PHP version upgrades as projects:
- Check that WordPress core, the theme and all plugins support the new version.
- Test on staging with the new version, ideally with debugging enabled to catch deprecation warnings.
- Install the new PHP version alongside the old one, so you can switch back quickly.
- Switch the site’s PHP-FPM pool to the new version, monitor error logs and keep the old version installed for a week or two.
Database upgrades
Minor database updates arrive through normal package updates. Major version upgrades, such as MySQL 8.0 to 8.4 or MariaDB 10.11 to 11.4, need more care. They may change defaults, deprecate settings and require data upgrades. Always take a full database backup first, read the upgrade notes and test on staging.
Major OS release upgrades
Ubuntu LTS releases receive standard support for five years. Debian releases receive about three years plus long-term support. When a release approaches end of life, you need to move to a newer one.
There are two approaches:
- In-place upgrade with do-release-upgrade on Ubuntu. It’s quicker but carries more risk, especially on servers with third-party repositories and custom configurations.
- Build a new server with the new release, migrate the sites and switch DNS. It takes longer but is cleaner, gives you a tested fallback and is the approach I prefer for production WordPress servers.
If you do upgrade in place, take a full snapshot first, disable third-party repositories during the upgrade and expect to fix some configuration afterwards, particularly for PHP and the web server.
Don’t leave it until the last week. Release upgrades are much less stressful a few months before end of life than a few days after.
Know what you’re running
A surprising number of server owners don’t know which OS version their server runs. Check it:
Write these down in your server documentation along with end-of-life dates. A simple table with “component, version, end of support” makes it obvious when action is needed.
Monitoring patch status
Add a few checks to your monitoring:
- Number of pending security updates
- Whether a reboot is required
- Days since last reboot
- OS and PHP end-of-life dates
Many monitoring tools include these checks, and even a small script that emails you a weekly summary is better than nothing.
The payoff
A server that’s patched regularly is far less likely to be compromised through a vulnerability outside WordPress, and far less likely to need an emergency rebuild when something finally breaks after years of neglect. Keeping a WordPress VPS patched takes a few minutes of automation and half an hour a month. Compared with recovering from a compromised server, it’s one of the best investments of time you can make.
Document the routine
Write the routine down: which updates are automatic, when reboots happen, who checks the server monthly and where the backups live. If someone else ever needs to take over the server, or you need to remember what you did eighteen months ago, the notes save hours. Include end-of-life dates for the OS, PHP and the database, and add calendar reminders three months before each one.
Snapshots before big changes
Most VPS providers offer snapshots. Take one before major updates, so a failed upgrade can be rolled back in minutes rather than hours.
Frequently asked questions
Will automatic updates break my WordPress site?
Security updates from the distribution’s security repository rarely break anything. Major changes to PHP or the database should be done manually and tested first.
How often should I reboot a WordPress server?
Whenever a kernel update requires it. For most servers, that’s roughly monthly. Livepatch services can apply some kernel fixes without rebooting.
Is managed hosting better for this?
Managed hosting removes the burden of server patching. If you don’t want to maintain a server, it’s often the better choice.
Should I update PHP as soon as a new version is released?
Wait until your plugins and theme confirm support, usually a few months after release, and test on staging first.




