๐ Installing NGINX
NGINX is a high-performance web server and reverse proxy widely used for hosting websites and efficiently handling web traffic. This guide covers installation steps for Ubuntu, CentOS, and macOS.
โ Prerequisitesโ
Before installing NGINX, ensure that:
- You have root/sudo privileges on the server. ๐
- Your system package manager is up to date. ๐
๐ 1. Installing NGINX on Ubuntu/Debianโ
๐ Step 1: Update the System
sudo apt update && sudo apt upgrade -y
๐ฅ Step 2: Install NGINX
sudo apt install nginx -y
โถ๏ธ Step 3: Start and Enable NGINX
sudo systemctl start nginx
sudo systemctl enable nginx
๐ Step 4: Verify Installation
nginx -v
You can also check if NGINX is running:
systemctl status nginx
๐ 2. Installing NGINX on CentOS/RHELโ
๐ Step 1: Update the System
sudo yum update -y
๐ฅ Step 2: Install NGINX
sudo yum install epel-release -y
sudo yum install nginx -y
โถ๏ธ Step 3: Start and Enable NGINX
sudo systemctl start nginx
sudo systemctl enable nginx
๐ Step 4: Verify Installation
nginx -v
๐ 3. Installing NGINX on macOS (Using Homebrew)โ
๐บ Step 1: Install Homebrew (If Not Installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
๐ฅ Step 2: Install NGINX
brew install nginx
โถ๏ธ Step 3: Start NGINX
brew services start nginx
๐ Step 4: Verify Installation
nginx -v
๐ฅ 4. Allowing NGINX Through Firewall (If Enabled)โ
๐ก Ubuntu/Debian (UFW Firewall)
sudo ufw allow 'Nginx Full'
sudo ufw enable
๐ก CentOS/RHEL (firewalld)
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
๐งช 5. Testing NGINX Installationโ
After installation, open your web browser and visit:
http://your-server-ip
You should see the default NGINX welcome page. ๐
To test via command line:
curl -I http://localhost
๐ Next Stepsโ
Once NGINX is installed, proceed to:
๐ Congratulations! You have successfully installed NGINX! ๐