Debian 10/11 安装最新版 Nginx

知了小站
2023-06-05 / 0 评论 / 945 阅读

Debian 10 安装最新版的Nginx

要在Debian 10 上安装最新版的Nginx,可以使用以下步骤

1、更新系统

sudo apt update
sudo apt upgrade

2、添加 Nginx 的存储库密钥

wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key

3、添加 Nginx 的存储库到apt源列表中

echo "deb http://nginx.org/packages/mainline/debian/ $(lsb_release -cs) nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

4、更新存储库并安装 Nginx

sudo apt update
sudo apt install nginx

# 启动 nginx
sudo systemctl start nginx
# 设置自启
sudo systemctl enable nginx

Debian 11 安装最新版的Nginx

在Debian 11 上安装最新版的Nginx,可以使用以下步骤

1、更新系统

sudo apt update
sudo apt upgrade
# 安装 Nginx 的依赖项
sudo apt install curl gnupg2 ca-certificates lsb-release

2、添加 Nginx 的存储库密钥

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg

3、添加 Nginx 的存储库到apt源列表中

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

4、更新存储库并安装 Nginx

sudo apt update
sudo apt install nginx
# 启动 nginx
sudo systemctl start nginx
# 设置自启
sudo systemctl enable nginx
本文共 125 个字数,平均阅读时长 ≈ 1分钟
1

打赏

评论 (0)

取消