# nginx Installation Guide Detailed installation instructions for nginx across different platforms. ## Table of Contents 1. [Ubuntu/Debian Installation](#ubuntudebian-installation) 2. [RHEL/CentOS/Rocky Installation](#rhelcentosrocky-installation) 3. [macOS Installation](#macos-installation) 4. [Docker Installation](#docker-installation) 5. [Building from Source](#building-from-source) 6. [Post-Installation](#post-installation) ## Ubuntu/Debian Installation ### Standard Installation ```bash # Update package list sudo apt update # Install nginx sudo apt install nginx -y # Enable nginx to start on boot sudo systemctl enable nginx # Start nginx sudo systemctl start nginx # Check status sudo systemctl status nginx ``` ### Latest Stable from Official Repository ```bash # Install prerequisites sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring # Import nginx signing key curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \ | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null # Add nginx stable repository echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \ http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \ | sudo tee /etc/apt/sources.list.d/nginx.list # Update and install sudo apt update sudo apt install nginx ``` ### Verify Installation ```bash nginx -v # nginx version: nginx/1.24.0 curl http://localhost # Should return nginx welcome page ``` ## RHEL/CentOS/Rocky Installation ### Standard Installation ```bash # Install nginx sudo dnf install nginx -y # Enable and start sudo systemctl enable nginx sudo systemctl start nginx # Configure firewall sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload ``` ### From Official Repository ```bash # Create repo file sudo tee /etc/yum.repos.d/nginx.repo <