How To Install Nginx on Linux
Step 1: Update Package Lists
Before installing Nginx, update the package lists for upgrades and new package installations. Open a terminal and run the following command:
Before installing Nginx, update the package lists for upgrades and new package installations. Open a terminal and run the following command:
sudo apt update
sudo apt update
Step 2: Install Nginx
To install Nginx on Ubuntu or Debian, run the following command:
To install Nginx on Ubuntu or Debian, run the following command:
sudo apt install nginx
sudo apt install nginx
This command will install the latest stable version of Nginx from the default package repository.
Step 3: Start Nginx
After the installation is complete, start the Nginx service and enable it to start automatically at boot using the following commands:
sudo systemctl start nginx sudo systemctl enable nginx
sudo systemctl start nginx sudo systemctl enable nginx
CentOS and Fedora
Step 1: Add the EPEL Repository (CentOS only)
For CentOS users, you’ll need to enable the EPEL (Extra Packages for Enterprise Linux) repository, which provides additional packages not included in the default CentOS repositories. To enable EPEL, run the following command:
sudo yum install epel-release
sudo yum install epel-release
Step 2: Install Nginx
To install Nginx on CentOS or Fedora, run the following command:
sudo yum install nginx
sudo yum install nginx
This command will install the latest stable version of Nginx from the package repository.
Step 3: Start Nginx
After the installation is complete, start the Nginx service and enable it to start automatically at boot using the following commands:
sudo systemctl start nginx sudo systemctl enable nginx
sudo systemctl start nginx sudo systemctl enable nginx
Step 4: Verify the Nginx Installation (all distributions)
To verify that Nginx is running, open your web browser and navigate to http://localhost (or the IP address of your Linux machine if accessing remotely). You should see the Nginx welcome page, indicating that the installation was successful.
And with that, you’ve completed the Nginx installation process on Linux.
Summary
Today, we’ve covered the process of installing Nginx on Windows, macOS, and Linux operating systems. By following the steps outlined for your specific platform, you should now have a working Nginx installation ready to handle your web server and reverse proxy tasks.
We encourage you to start using Nginx for your web applications, as it offers excellent performance, scalability, and flexibility. As you continue to work with Nginx, you’ll find a wealth of resources available online to help you learn more and troubleshoot any issues you may encounter. The official Nginx documentation is a great place to start, as well as various community forums and blogs.
0 Comments
CAN FEEDBACK
Emoji