Sys-Admin

Nginx

Installation

Debian

  1. Install the prerequisites:
    sudo apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring
    
  2. Import an official nginx signing key so apt could verify the packages authenticity. Fetch the key:
    curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
    | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
    
  3. To set up the apt repository for stable nginx packages, run the following command:
    echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
    http://nginx.org/packages/debian `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list
    
  4. Install nginx, run the following commands:
    sudo apt update
    sudo apt install nginx
    
  5. Enable nginx. Auto restart on boot.
    systemctl enable nginx
    

Reference

  1. Nginx docs