Created
January 21, 2026 13:58
-
-
Save NotYusta/7251add0760f4ea58d70d3c05100e67f to your computer and use it in GitHub Desktop.
Auto installer nginx open source debian.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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