📅  最后修改于: 2023-12-03 14:44:35.633000             🧑  作者: Mango
If you are using Debian and need to install nginx web server, the recommended way is to use the official Debian repository. However, if you need a more recent version of nginx or need features not available in the official package, you can use the nginx Personal Package Archive (PPA) repo.
This guide will show you how to add the nginx PPA to your Debian system and install nginx from it.
Before proceeding with this guide, ensure you have:
To add the nginx PPA repo to your Debian system, open a terminal and enter the following commands:
sudo apt-get install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list
echo "deb-src http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" \
| sudo tee -a /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
The first command installs the necessary packages for adding the PPA repo. The second and third commands add the PPA repo to your system's sources list. The last command adds the signing key required to authenticate the packages from the PPA.
After adding the PPA repo, run the following commands to update your system's package list and install nginx:
sudo apt-get update
sudo apt-get install nginx
Nginx should now be installed and running on your Debian system.
In this guide, you learned how to add the nginx PPA to your Debian system and install nginx from it. This allows you to install a more recent version of nginx or access features not available in the official Debian package.