Sign inSign up

hczjl/npm

By hczjl

•Updated over 3 years ago

用于管理 Nginx 代理主机的 Docker 容器,具有简单、强大的界面

Image
0

210

hczjl/npm repository overview



⁠ ⁠

官方网址:https://nginxproxymanager.com/⁠

汉化:https://github.com/xiaoxinpro/nginx-proxy-manager-zh⁠

该项目作为预构建的 docker 镜像提供,使您能够轻松转发到您在家中或其他地方运行的网站,包括免费 SSL,而无需了解太多有关 Nginx 或 Letsencrypt 的信息。

⁠特点

  • 基于Tabler的美观安全的管理界面
  • 在对 Nginx 一无所知的情况下轻松创建转发域、重定向、流和 404 主机
  • 使用 Let's Encrypt 的免费 SSL 或提供您自己的自定义 SSL 证书
  • 主机的访问列表和基本 HTTP 身份验证
  • 超级用户可用的高级 Nginx 配置
  • 用户管理、权限和审计日志

⁠安装

  1. 安装 Docker 和 Docker-Compose

  2. 创建一个docker-compose.yml文件:

version: "3"
services:
  app:
    image: 'hczjl/npm:2.9.19'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP

    # Uncomment the next line if you uncomment anything in the section
    # environment:
      # Uncomment this if you want to change the location of 
      # the SQLite DB file within the container
      # DB_SQLITE_FILE: "/data/database.sqlite"

      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'

    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

然后:

docker-compose up -d
⁠使用 MySQL / MariaDB 数据库

如果您选择 MySQL 配置,则必须自己提供数据库服务器。您也可以使用 MariaDB。以下是最低支持版本:

  • MySQL v5.7.8+
  • MariaDB v10.2.7+

也很容易为您的数据库使用另一个 docker 容器并将其链接为 docker 堆栈的一部分,因此这就是以下示例将要使用的内容。

docker-compose.yml以下是使用 MariaDB 容器时的示例:

version: "3"
services:
  npm:
    image: 'hczjl/npm:2.9.19'
    container_name: npm_server
    restart: always
    depends_on:
      - npm_db
    networks:
      network:
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm_db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm@A"
      DB_MYSQL_NAME: "npm"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

  npm_db:
    image: 'hczjl/mariadb:10.4.15'
    container_name: npm_db
    restart: always
    networks:
      network:
    environment:
      MYSQL_ROOT_PASSWORD: 'npm@A'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm@A'
    volumes:
      - ./data/mysql:/var/lib/mysql
networks:
  network:

请注意,DB_MYSQL_环境变量将优先于DB_SQLITE_变量。所以如果你保留 MySQL 变量,你将无法使用 SQLite。

⁠初始运行

应用程序首次运行后,将发生以下情况:

  1. 数据库将使用表结构进行初始化
  2. GPG密钥将生成并保存在配置文件中
  3. 将创建一个默认的管理员用户

此过程可能需要几分钟,具体取决于您的机器。

⁠默认管理员用户

Email: [email protected]
Password: changeme

使用此默认用户登录后,系统会立即要求您修改详细信息并更改密码。

⁠自定义 Nginx 配置

如果您是更高级的用户,您可能渴望获得额外的 Nginx 可定制性。

NPM 能够在不同的地方包含不同的自定义配置片段。

您可以在以下位置添加自定义配置片段文件/data/nginx/custom:

  • /data/nginx/custom/root.conf:包含在 nginx.conf 的最后
  • /data/nginx/custom/http_top.conf: 包含在主 http 块的顶部
  • /data/nginx/custom/http.conf: 包含在主 http 块的末尾
  • /data/nginx/custom/stream.conf: 包含在主流块的末尾
  • /data/nginx/custom/server_proxy.conf:包含在每个代理服务器块的末尾
  • /data/nginx/custom/server_redirect.conf:包含在每个重定向服务器块的末尾
  • /data/nginx/custom/server_stream.conf:包含在每个流服务器块的末尾
  • /data/nginx/custom/server_stream_tcp.conf: 包含在每个 TCP 流服务器块的末尾
  • /data/nginx/custom/server_stream_udp.conf: 包含在每个 UDP 流服务器块的末尾

Tag summary

Content type

Image

Digest

sha256:e5cc396e6…

Size

320.2 MB

Last updated

over 3 years ago

docker pull hczjl/npm:2.9.19