Ugacomp

How to upgrade Nginx to the latest version

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM

CLOUD VPS M

$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM

CLOUD VPS L

$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

Nginx developers frequently release updates to enhance features, security, and performance. Keeping your Nginx installation up-to-date is crucial for maintaining a secure and efficient web server. This article provides a detailed guide on how to upgrade Nginx to the latest version.

Check the Current Nginx Version

Before initiating the upgrade process, it’s essential to know the currently installed version of Nginx. Execute the following command to check the version:

nginx -v

Backup Nginx Configuration

As a precautionary measure, create a backup of your Nginx configuration files. These files are typically located in /etc/nginx/ or /etc/nginx/conf.d/. Backup ensures that you can revert to the previous configuration if any issues arise during the upgrade.

Download the Latest Version

Visit the official Nginx download page and find the link to the latest stable version. Use the wget command to download the source tarball:

wget https://nginx.org/download/nginx-<version>.tar.gz

Replace <version> with the actual version number.

Extract the Tarball

Navigate to the directory where the tarball was downloaded and use the tar command to extract its contents:

tar -zxvf nginx-<version>.tar.gz

Configure and Compile

Change into the extracted directory and configure the build:

cd nginx-<version>
./configure

After configuring, compile the source code:

make

Install the New Version

Install the newly compiled version of Nginx:

sudo make install

Verify the New Version

Confirm that the new version is installed by checking the Nginx version:

nginx -v

Restart Nginx

Restart the Nginx service to apply the changes:

sudo service nginx restart

If your system uses systemctl:

sudo systemctl restart nginx

Check Nginx Status

Ensure that Nginx restarted successfully and is running without issues:

sudo service nginx status

Conclusion

Upgrading Nginx to the latest version is a critical task to benefit from improved features, security patches, and performance enhancements. Following the steps outlined in this guide can seamlessly upgrade your Nginx installation, ensuring a smooth and efficient web server operation.

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.
 

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.