Skip to content

Instantly share code, notes, and snippets.

@NotYusta
Created January 21, 2026 13:58
Show Gist options
  • Select an option

  • Save NotYusta/7251add0760f4ea58d70d3c05100e67f to your computer and use it in GitHub Desktop.

Select an option

Save NotYusta/7251add0760f4ea58d70d3c05100e67f to your computer and use it in GitHub Desktop.
Auto installer nginx open source debian.
#!/bin/sh
# Update system and install dependencies
sudo apt update && \
sudo apt install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring
# Add NGINX official 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 repository
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
https://nginx.org/packages/debian $(lsb_release -cs) nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
# Set APT pinning to prefer NGINX.org packages
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx
# Update and install NGINX
sudo apt update && sudo apt install -y nginx
# Clean up apt cache
sudo apt clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment