Install NGINX on Debian from the Official NGINX Repository

Updated by Linode Written by Linode

Contribute on GitHub

Report an Issue | View File | Edit File

These instructions install NGINX Mainline on Debian 9 from NGINX Inc’s official repository. For other distributions, see the NGINX admin guide. For information on configuring NGINX for production environments, see our Getting Started with NGINX series.

  1. Open /etc/apt/sources.list in a text editor and add the following line to the bottom:

    /etc/apt/sources.list
    1
    
    deb http://nginx.org/packages/mainline/debian/ stretch nginx
  2. Import the repository’s package signing key and add it to apt:

    sudo wget http://nginx.org/keys/nginx_signing.key
    sudo apt-key add nginx_signing.key
    
  3. Install NGINX:

    sudo apt update
    sudo apt install nginx
    
  4. Ensure NGINX is running and and enabled to start automatically on reboots:

    sudo systemctl start nginx
    sudo systemctl enable nginx
    

Join our Community

Find answers, ask questions, and help others.

This guide is published under a CC BY-ND 4.0 license.