nginx-proxy-manager介紹
nginx-proxy-manager 是一個NGINX反向代理管理系統,相當于在 Web 界面上進行可視化配置Nginx。還可以獲得受信任的 SSL 證書,并通過單獨的配置、自定義和入侵保護來管理多個代理。界面截圖請閱讀到底部檢視!
nginx-proxy-manager
這個項目是為了滿足個人需求,為使用者提供一種簡單的方法來完成反向 使用SSL終止代理主機,它必須非常簡單,以至于猴子可以做到這一點。這個目标沒有改變。 雖然可能有進階選項,但它們是可選的,項目應該盡可能簡單 這樣這裡的進入門檻就低了。
特征
- 基于Tabler的美觀安全的管理界面
- 輕松建立轉發域、重定向、流和 404 主機,而無需了解 Nginx
- 使用Let's Encrypt或提供您自己的自定義SSL證書的免費SSL
- 主機的通路清單和基本 HTTP 身份驗證
- 進階 Nginx 配置可供超級使用者使用
- 使用者管理、權限和稽核日志
快速安裝
- 安裝 Docker 和 Docker-Compose
- Docker安裝
- Docker-Compose 安裝
- 建立一個類似于下面的 docker-compose.yml 檔案:
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
- 通過運作來啟動
docker-compose up -d
# If using docker-compose-plugin
docker compose up -d
- 登入到管理界面
當您的 docker 容器運作時,在管理界面的端口上連接配接到它。 有時,由于密鑰的原因,這可能需要一點時間。
http://127.0.0.1:81
預設管理者使用者:
Email: [email protected]
Password: changeme
使用此預設使用者登入後,系統會立即要求您修改您的詳細資訊并更改密碼。
完整設定說明
運作應用
建立一個檔案:docker-compose.yml
version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
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 堆棧的一部分,是以這就是以下示例 将使用。
以下是使用 MariaDB 容器時的外觀示例:docker-compose.yml
version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
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
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "npm"
DB_MYSQL_NAME: "npm"
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: 'true'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
volumes:
- ./data/mysql:/var/lib/mysql
注意
請注意,環境變量将優先于變量。是以,如果您保留MySQL變量,您将無法使用SQLite。DB_MYSQL_*DB_SQLITE_*
自定義 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/events.conf:包含在事件塊的末尾
- /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 流伺服器塊的末尾
每個檔案都是可選的。
X_FRAME_OPTIONS 配置
您可以配置X-FRAME-OPTIONS頁眉 值,将其指定為 Docker 環境變量。如果未指定,則預設值為 。deny
...
environment:
X_FRAME_OPTIONS: "sameorigin"
...
更新
docker-compose pull
docker-compose up -d
此項目将自動更新任何資料庫或其他要求,是以您不必遵循 任何瘋狂的訓示。上面的這些步驟将提取最新更新并重新建立 docker
web管理界面
1、使用者登入界面
登入
2、自定義配置
自定義配置
3、添加配置
清單
添加配置
4、看闆
看闆
5、定義404主機
404主機
6、權限配置
permissions