Skip to content

Instantly share code, notes, and snippets.

@Koratsuki
Created August 21, 2025 14:55
Show Gist options
  • Save Koratsuki/a6ab8074948537aa2e876a18c960b618 to your computer and use it in GitHub Desktop.
Save Koratsuki/a6ab8074948537aa2e876a18c960b618 to your computer and use it in GitHub Desktop.
Install latest version of Nginx on Debian/Ubuntu

Install latest version of Nginx on Debian/Ubuntu

Install GPG:

sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring -y

Download repo key:

curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
  | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null

Generate .list file for the repo config:

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/ubuntu $(lsb_release -cs) nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list

Update & install nginx:

sudo apt update && sudo apt install nginx -y

Enable service init on startup:

sudo systemctl enable nginx

Enjoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment