The fast way to install nginx.org debs on Debian
I personally prefer the nginx.org packages for nginx over the ones that comes with Debian. They are usually newer and have a more sane amount of dependencies. I also prefer the conf.d
system over the sites-available
and sites-enabled
system.
The main challenge in installing these packages on Debian is the trouble you have to go through to get the PGP keys and sources.list
set up. nginx.org does not present a good setup script. This has become a repetitive and annoying experience, so I present a series of commands to set it up quickly.
For stable
:
curl https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
(codename="$(dpkg --status tzdata | grep Provides | cut -f2 -d'-')"; echo; for deb in deb deb-src; do echo $deb http://nginx.org/packages/debian/ "$codename" nginx; done) | sudo tee -a /etc/apt/sources.list
sudo apt update && sudo apt install nginx
For mainline
:
curl https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
(codename="$(dpkg --status tzdata | grep Provides | cut -f2 -d'-')"; echo; for deb in deb deb-src; do echo $deb http://nginx.org/packages/mainline/debian/ "$codename" nginx; done) | sudo tee -a /etc/apt/sources.list
sudo apt update && sudo apt install nginx