NewExtra server protection with Measured Boot & UKI images.View Measured Boot
BlogDocumentationFAQNo Third-Party CookiesContact Us
  • Pricing
Log inSign up
Cloud VPSVDSMemory-Optimized VDSStorage-Optimized VDSWindows VPSBitcoin VPSDDoS ProtectionPrivate Networking (VPC)Floating IPsAdditional Server SupportMicrosoft LicensesDatacenterNetworkDocumentationFAQNo Third-Party CookiesConfidential ComputingSelf-Hosted VPNBlogAboutBrand GuidelinesAffiliatesContact UsLegal & Compliance

Products

  • Pricing
  • Cloud VPS
  • VDS
  • RAM-Optimized VDS
  • Storage-Optimized VDS
  • Windows VPS
  • Bitcoin VPS
  • DDoS Protection
  • Private Networking (VPC)
  • Floating IPs
  • Microsoft Licenses
  • Additional Server Support

Explore

  • Documentation
  • Developers API Docs
  • FAQ
  • Datacenter
  • Network
  • Looking Glass
  • Confidential Computing
  • Cookie Policy
  • Self-Hosted VPN

Company

  • Blog
  • Contact Us
  • About Us
  • Brand Guidelines
  • Affiliates

Legal & Compliance

  • Terms of Service
  • Privacy Policy
  • Data Processing Agreement
  • Acceptable Use Policy
  • Microsoft Software Terms of Use
  • Refund Policy
  • Report Abuse

Products

  • Cloud VPS
  • VDS
  • RAM-Optimized VDS
  • Storage-Optimized VDS
  • Windows VPS
  • Bitcoin VPS
  • DDoS Protection
  • Private Networking (VPC)
  • Floating IPs
  • Microsoft Licenses
  • Additional Server Support
Pricing

Explore

  • Documentation
  • Developers API Docs
  • FAQ
  • Datacenter
  • Network
  • Looking Glass
  • Confidential Computing
  • Cookie Policy
  • Self-Hosted VPN

Company

  • Blog
  • Contact Us
  • About Us
  • Brand Guidelines
  • Affiliates

Legal & Compliance

  • Terms of Service
  • Privacy Policy
  • Data Processing Agreement
  • Acceptable Use Policy
  • Microsoft Software Terms of Use
  • Refund Policy
  • Report Abuse

© VPS.BG Ltd. 2026 · All rights reserved!

Made with passion in Bulgaria · VAT ID: BG203144520

Contents

  • How to update your Linux system
  • How to update Nginx
  • How to keep MySQL up to date
  • How to update your PHP version

Subscribe to Our Newsletter

Join 5000+ subscribers and receive helpful content, deals and more! We promise no spam - 100% great content. Unsubscribe anytime.

Share Article

#LEMP
  1. Documentation
  2. /
  3. #LEMP
  4. /
  5. How to keep the LEMP stack up to date

How to keep the LEMP stack up to date

Published: 03 January 2024 • 3 min read

#Tutorial#LEMP

When it comes to keeping your LEMP stack up to date, you will have to manually update each component individually. In this tutorial we are going to cover in detail how to upgrade your Linux, Nginx, MySQL and PHP version.

How to update your Linux system

Start by opening a terminal window. You will then need to update the package repositories using the following command:

sudo apt-get update

The last command will fetch the available package updates to your system. After fetching, you will be able to continue with downloading and installing them as shown in the following command.

sudo apt-get upgrade

This will bring up a list of all the packages that are going to be updated. Make sure you go over them in detail, enter Y to proceed and the update process will then start. Once it has concluded, you might be asked to restart your system in order for the updates to be applied, if that is the case you can then proceed with restarting the system.

IMPORTANT: Before updating, it is always a good idea to backup your system!

One limitation of “apt-get upgrade” is that it never installs new packages and never deletes existing ones, it only upgrades the current packages to their newer versions. If you wish to upgrade to the latest stable version of your Linux distribution, which could include the automatic removal or addition of recommended packages you can do so with this command:

sudo apt-get dist-upgrade

Additionally, if you are using a rolling release distro like Arch, you can update Linux with this command instead:

sudo pacman -Syu

How to update Nginx

It is crucial for your server’s and LEMP stack’s security to keep Nginx up to date. Here’s how to update Nginx for the different Linux versions. Keep in mind that these steps are not needed if you have already run the above steps for upgrading the whole system.

Start by backing up all of your Nginx configuration files:

sudo cp -rf /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
sudo cp -rf /etc/nginx/sites-enabled/* /etc/nginx/sites-available/*.bak

Next, you will need to update the package repositories and proceed with proceed to upgrade Nginx.

Debian/Ubuntu:

sudo apt-get update
sudo apt-get upgrade nginx

On CentOS/RHEL only a single command is needed:

sudo yum update nginx

When the update concludes, you will need to verify the Nginx version:

nginx -v

IMPORTANT: If you have made any custom changes to your Nginx configuration files, make sure to carefully review them prior to upgrading in order to ensure that they are still compatible with the version you are going to be installing. The same applies for any additional third-party Nginx modules.

How to keep MySQL up to date

Ubuntu/Debian

Back up your existing MySQL data:

sudo mysqldump -u root -p --all-databases > /path/to/backup.sql

Update the package lists:

sudo apt update

Upgrade MySQL:

sudo apt upgrade mysql-server

Verify the new MySQL version:

mysql --version

CentOS/RHEL

Back up your existing MySQL data:

sudo mysqldump -u root -p --all-databases > /path/to/backup.sql

Upgrade MySQL:

sudo yum update mysql-server

IMPORTANT: If you have altered your configuration files, make sure to check them before upgrading. The same goes for any third-party plugins.

How to update your PHP version

Start by checking your current PHP version:

php -v

Next, update the package list.

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install php8.3 (choose your new version)

CentOS/RHEL:

sudo yum install php8.3 (choose your new version)

Then, check whether the version has been installed:

php -v

To ensure everything will run smoothly, you can finally restart Nginx:

sudo systemctl restart nginx

IMPORTANT: Make sure to check the compatibility with any third-party plugins, extension and PHP frameworks as well as any custom configurations.

Subscribe to Our Newsletter

Join 5000+ subscribers and receive helpful content, deals and more! We promise no spam - 100% great content. Unsubscribe anytime.

Share Article

Related Content

04 December 2023

How to operate your Webmin cloud server

Learn how to operate your Webmin cloud server as well as how to reset your password, update the service and restart the control panel!

#Tutorial#Webmin
26 February 2023

How to manage a VPSBG cloud server with WireGuard VPN

In this tutorial you are going to learn how to manage a cloud server with WireGuard VPN including how to connect and manage your user profiles.

#Tutorial#WireGuard
09 October 2023

How to Install Webmin Modules

Webmin modules can help you manage your control panel and server! Learn how to install modules from a local or uploaded file, a URL and a repository!

#Tutorial#Webmin
10 November 2023

How to manage your Laravel application template

Learn more about our Laravel app template! We install the framework on top of LEMP so that you can immediately start using your application!

#Tutorial#Laravel

Privacy-First, App-Ready Cloud Servers

Deploy a powerful and secure cloud VPS server with a popular pre-installed application with a single click!

Deploy App TemplateContact Us