差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:nginx_proxy_manager [2024/07/24 21:04] – 增加 goaccess 與 watchtower 自動更新 jonathantech:nginx_proxy_manager [2026/05/05 16:30] (目前版本) – [編輯與啟動] jonathan
行 1: 行 1:
-====== 安裝 Nginx Proxy Manager(NPM) 當 Revers Proxy Server(Docker) ======+====== Nginx Proxy Manager(NPM) 當 Revers Proxy Server(Docker) ======
   * 環境 : [[tech/alpine_docker]]   * 環境 : [[tech/alpine_docker]]
   * 安裝的主機 IP : 192.168.11.231   * 安裝的主機 IP : 192.168.11.231
行 42: 行 42:
  
   watchtower:   watchtower:
-    image: containrrr/watchtower+    image: nickfedor/watchtower
     container_name: watchtower     container_name: watchtower
     volumes:     volumes:
行 83: 行 83:
   * 編輯 Proxy Host -> Advanced -> Custom Nginx Configuration 加入 <cli>real_ip_header CF-Connecting-IP;</cli> 即可 \\ {{:tech:2022-09-03_22_42_06.png|}}   * 編輯 Proxy Host -> Advanced -> Custom Nginx Configuration 加入 <cli>real_ip_header CF-Connecting-IP;</cli> 即可 \\ {{:tech:2022-09-03_22_42_06.png|}}
  
-==== 2. 解決無法下載後端 NextCloud 超過 1GB 大檔案的設定 ==== +==== 2. 解決無法下載Proxy Host 超過 1GB 大檔案的設定 ==== 
-  * https://rodrigolmti.medium.com/nextcloud-with-portainer-nginx-proxy-manager-63df45d62a0b+  * Proxy Host 是 NextCloud 要提供檔案下載時發現預設下載檔案大小限制為 1GB 
 +  * 參考 - https://rodrigolmti.medium.com/nextcloud-with-portainer-nginx-proxy-manager-63df45d62a0b 
 +  * 另外 NextCloud/all-in-one 會開啟 TRACE and TRACK method, 會造成主機弱點, 也順便設定關閉
   * 編輯 Proxy Host -> Advanced -> Custom Nginx Configuration 加入 <cli>   * 編輯 Proxy Host -> Advanced -> Custom Nginx Configuration 加入 <cli>
-proxy_set_header Host $host+client_body_buffer_size 512k
-proxy_set_header X-Forwarded-Proto $scheme; +proxy_read_timeout 86400s;
-proxy_set_header X-Real-IP $remote_addr; +
-proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +
-proxy_max_temp_file_size 16384m;+
 client_max_body_size 0; client_max_body_size 0;
-location = /.well-known/carddav +if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS)$) 
-  return 301 $scheme://$host:$server_port/remote.php/dav;+    return 405;
 } }
-location = /.well-known/caldav { +</cli>
-  return 301 $scheme://$host:$server_port/remote.php/dav; +
-}</cli>+
  
 ==== 3. 解決忘記登入資訊的做法 ==== ==== 3. 解決忘記登入資訊的做法 ====
行 176: 行 173:
 docker compose logs -f docker compose logs -f
 </cli> </cli>
 +
 +==== 8. 升級到 v2.12.4 後管理介面無法登入議題 ====
 +  * log 出現 - Cannot install certbot-dns-cloudflare==4.0.0 and cloudflare==4.0.*
 +  * 參考 - https://github.com/NginxProxyManager/nginx-proxy-manager/issues/4606
 +  * 目前 Workaround 作法
 +    - 進入 NPM 容器內執行 Exp. <cli>
 +pve-rproxy:~# docker compose ps
 +NAME                  IMAGE                             COMMAND         SERVICE               CREATED          STATUS                    PORTS
 +nginx-proxy-manager   jc21/nginx-proxy-manager:latest   "/init"         nginx-proxy-manager   29 minutes ago   Up 11 minutes             0.0.0.0:80-81->80-81/tcp, :::80-81->80-81/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp
 +pve-rproxy:~# docker compose exec -it nginx-proxy-manager bash
 +                    ____                      __  __
 +| \ | | __ _(_)_ __ __  _|  _ \ _ __ _____  ___   _|  \/  | __ _ _ __   __ _  __ _  ___ _ __
 +|  \| |/ _` | | '_ \\ \/ / |_) | '__/ _ \ \/ / | | | |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
 +| |\  | (_| | | | | |>  <|  __/| | | (_) >  <| |_| | |  | | (_| | | | | (_| | (_| |  __/ |
 +|_| \_|\__, |_|_| |_/_/\_\_|   |_|  \___/_/\_\\__, |_|  |_|\__,_|_| |_|\__,_|\__, |\___|_|
 +       |___/                                  |___/                          |___/
 +Version 2.12.4 (b84762b) 2025-07-01 01:23:38 UTC, OpenResty 1.27.1.1, debian 12 (bookworm), Certbot certbot 4.0.0
 +Base: debian:bookworm-slim, linux/amd64
 +Certbot: nginxproxymanager/nginx-full:latest, linux/amd64
 +Node: nginxproxymanager/nginx-full:certbot, linux/amd64
 +
 +[root@docker-434df09eec04:/app]# sh -c "sed -i 's/cloudflare==4.0.\*/cloudflare/' /app/global/certbot-dns-plugins.json"
 +[root@docker-434df09eec04:/app]# exit
 +exit
 +</cli>
 +    - 重新啟動容器 <cli>
 +pve-rproxy:~# docker compose restart
 +[+] Restarting 1/1
 + ✔ Container nginx-proxy-manager  Started                                                                                                                                                                                               3.5s
 +pve-rproxy:~#
 +</cli>
 +
 +==== 9. 查看 SSL Certificates 紀錄的設定內容 ====
 +  * 因為 Web UI 只能針對 SSL Certificates 新增或刪除, 如果想了解之前設定的相關內容, 只能進入 sqlite 內查看
 +  * 進入 data 目錄應該可以看到 database.sqlite
 +  * 使用 sqlite3 進入查詢<cli>
 +~/nginx-proxy-manager/data# sqlite3 database.sqlite
 +SQLite version 3.49.2 2025-05-07 10:39:52
 +sqlite> select * from certificate;
 +1|2024-01-25 12:55:03|2025-10-04 09:16:37|1|0|letsencrypt|*.my.ichiayi.com|["*.my.ichiayi.com"]|2026-01-02 08:18:47|{"letsencrypt_email":"[email protected]","dns_challenge":true,"dns_provider":"cloudflare","dns_provider_credentials":"# Cloudflare API token\r\ndns_cloudflare_api_token = xO************************************06","letsencrypt_agree":true}
 +</cli>
 +  * 如果有興趣了解整個資料庫結構可以下 **.fullschema** 查看<cli>
 +sqlite> .fullschema
 +CREATE TABLE `knex_migrations` (`id` integer not null primary key autoincrement, `name` varchar(255), `batch` integer, `migration_time` datetime);
 +CREATE TABLE `knex_migrations_lock` (`index` integer not null primary key autoincrement, `is_locked` integer);
 +CREATE TABLE `migrations` (`id` integer not null primary key autoincrement, `name` varchar(255), `batch` integer, `migration_time` datetime);
 +:
 +CREATE TABLE `access_list_client` (`id` integer not null primary key autoincrement, `created_on` datetime not null, `modified_on` datetime not null, `access_list_id` integer not null, `address` varchar(255) not null, `directive` varchar(255) not null, `meta` json not null);
 +/* No STAT tables available */
 +</cli>
 +
  
 ===== 參考網址 ===== ===== 參考網址 =====
  • tech/nginx_proxy_manager.1721826292.txt.gz
  • 上一次變更: 2024/07/24 21:04
  • jonathan