Depoly

Nginx Proxy Manager 站点反代

Nginx Proxy Manager 是一个基于 Nginx 的开源工具,提供用户友好的 Web 界面,用于轻松管理反向代理、SSL/TLS 证书、域名解析和访问控制等网络配置。

视频教程

请务必结合视频教程食用,因为细节内容都在视频中讲解,本文主要供小伙伴们拷贝代码用途。

查看视频:油管 B站

安装 Docker

屏蔽IPV6(可选)

terminal
# 编辑 sysctl.conf
vim /etc/sysctl.conf

# 以下行以禁用 IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

# 加载新配置
sysctl -p

设置软件源

terminal
# Uninstall all conflicting packages
 for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

安装 Docker 服务

terminal
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

安装 Nginx Proxy Manager

Docker Compose 配置文件

yml
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

运行 Nginx Proxy Manager

terminal
# 启动
docker compose up -d

# 停止
docker compose down

# 查看日志
docker composoe logs -f

Copyright © 2024