問題 - 我在嘗試存取應用程式(包括第一次)時收到 404 - 檔案未找到
當嘗試透過 nextcloud.example.com 在瀏覽器上存取應用程式時,我從 NextCloud FMP Docker 容器的控制台日誌中收到此錯誤:
172.19.0.5 - 04/Mar/2023:22:36:01 +0000 "GET /index.php" 404
NGinX Docker 容器的控制台日誌中出現此錯誤:
172.69.67.108 - - [04/Mar/2023:22:36:01 +0000] "GET / HTTP/2.0" 404 36 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" "xxx.my.ip.xxx"
Docker 伺服器主機和容器的設定
Docker 主機伺服器作業系統是 Ubuntu 22.04 LTS
NGinX Docker 容器,我知道 docker-compose.yml 是最好的,但現在直到我讓它正常工作之前,我正在運行容器:
docker run -p 80:80 -p 443:443 --name nginx \ --restart=unless-stopped \ -v certbot:/etc/letsencrypt \ -v nginx:/etc/nginx/conf.d \ -v www:/usr/share/nginx/html \ --network tools \ -d nginx
這是 Docker 伺服器主機上唯一暴露連接埠的容器,並使用磁碟區掛載來共用:
- 使用 CertBot 容器的證書
- NGinX Conf Directory 為每個應用程式設定一個conf
- HTML www root home 與 NextCloud FPM Docker 容器共用
- 網路工具
NextCloud FPM Docker 容器,我正在使用以下命令執行容器:
docker run --name nextcloud-fpm \ --restart=unless-stopped \ -v www:/var/www/html \ -e 'TRUSTED_PROXIES=nginx' \ -e 'POSTGRES_HOST=database.server.com' \ -e 'POSTGRES_USER=database_user' \ -e 'POSTGRES_PASSWORD=database_user_password' \ -e 'POSTGRES_DB=databse_name' \ --network tools \ -d nextcloud:fpm
該容器在相同的網路工具上運行,不必將應用程式的連接埠暴露給 Docker 主機伺服器,並且在需要使用容器名稱而不是 IP 來建立容器堆疊和 NGinX conf 檔案時更容易代理逆轉
- HTML www root home 與 NGinX Docker 容器共用
- 可信任代理的環境變數(NGinX 容器
- PostgreSQL 資料庫的環境變量
- 此 Cotainer 在連接埠 9000 上執行 FPM
- 網路工具
NGinX conf 文件,有 2 個,其中一個是 default.conf,主要是不允許透過 IP 和連接埠直接存取主機伺服器(例如 xxx.xxx.xxx.xxx:80 或 xxx.xxx.xxx.xxx:443 ):
server { # Removes Web Server Info server_tokens off; # HTTP listen 80 default_server; listen [::]:80 default_server; listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; ssl_reject_handshake on; # Identify Server without the name, hence just IP server_name _; # Return Empty Response return 444; }
最後是 nextcloud.conf,它取自GitHub NextCloud FPM 官方儲存庫:
upstream php-handler { server nextcloud-fpm:9000; # In here I set up the Stream with the NextCloud FPM Container name } server { listen 80; listen [::]:80; server_name nextcloud.example.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; listen [::]:443 ssl; server_name nextcloud.example.com; ssl_certificate /etc/letsencrypt/live/nextcloud.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/nextcloud.example.com/privkey.pem; # HSTS settings # WARNING: Only add the preload option once you read about # the consequences in https://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; # set max upload size client_max_body_size 512M; fastcgi_buffers 64 4K; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/> # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. #pagespeed off; # HTTP response headers borrowed from Nextcloud `.htaccess` add_header Referrer-Policy "no-referrer" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Download-Options "noopen" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Permitted-Cross-Domain-Policies "none" always; add_header X-Robots-Tag "none" always; add_header X-XSS-Protection "1; mode=block" always; # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; # Path to the root of your installation root /usr/share/nginx/html/; # Since NGinX is the Web Server, I am pointing root to where the NextCloud Files are mounted inside the NGinX Container from the NextCloud FPM Container # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists # on the server. In particular, if that directory contains an index.php file, # that file is correctly served; if it doesn't, then the request is passed to # the front-end controller. This consistent behaviour means that we don't need # to specify custom rules for certain paths (e.g. images and other assets, # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus # `try_files $uri $uri/ /index.php$request_uri` # always provides the desired behaviour. index index.php index.html /index.php$request_uri; # Rule borrowed from `.htaccess` to handle Microsoft DAV clients location = / { if ( $http_user_agent ~ ^DavClnt ) { return 302 /remote.php/webdav/$is_args$args; } } location = /robots.txt { allow all; log_not_found off; access_log off; } # Make a regex exception for `/.well-known` so that clients can still # access it despite the existence of the regex rule # `location ~ /(\.|autotest|...)` which would otherwise handle requests # for `/.well-known`. location ^~ /.well-known { # The rules in this block are an adaptation of the rules # in `.htaccess` that concern `/.well-known`. location = /.well-known/carddav { return 301 /remote.php/dav/; } location = /.well-known/caldav { return 301 /remote.php/dav/; } location /.well-known/acme-challenge { try_files $uri $uri/ =404; } location /.well-known/pki-validation { try_files $uri $uri/ =404; } # Let Nextcloud's API for `/.well-known` URIs handle all other # requests by passing them to the front-end controller. return 301 /index.php$request_uri; } # Rules borrowed from `.htaccess` to hide certain paths from clients location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } # Ensure this block, which passes PHP files to the PHP process, is above the blocks # which handle static assets (as seen below). If this block is not declared first, # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php` # to the URI, resulting in a HTTP 500 error response. location ~ \.php(?:$|/) { # Required for legacy support rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri; fastcgi_split_path_info ^(.+?\.php)(/.*)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $path_info; #fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice fastcgi_param front_controller_active true; # Enable pretty urls fastcgi_pass php-handler; fastcgi_intercept_errors on; fastcgi_request_buffering off; } location ~ \.(?:css|js|svg|gif)$ { try_files $uri /index.php$request_uri; expires 6M; # Cache-Control policy borrowed from `.htaccess` access_log off; # Optional: Don't log access to assets } location ~ \.woff2?$ { try_files $uri /index.php$request_uri; expires 7d; # Cache-Control policy borrowed from `.htaccess` access_log off; # Optional: Don't log access to assets } # Rule borrowed from `.htaccess` location /remote { return 301 /remote.php$request_uri; } location / { try_files $uri $uri/ /index.php$request_uri; } }
到目前為止我已經嘗試過的
我的第一直覺是檢查日誌,我在本文開頭分享了它們,並基於此我去檢查文件是否存在於兩個容器上,我用兩種不同的方式做到了這一點:
我有一個 Portainer 容器在同一個 Docker 主機伺服器上運行,並且也在正常的 NGinX Docker 容器後面作為反向代理,我附加了一個控制台並查找兩個容器內的文件,也在
docker exec container_name -it bash
兩個容器上執行了以下操作:NGinX 容器,記住安裝座已打開
/usr/share/nginx/html
root@61564cff4e67:/# ls -lha /usr/share/nginx/html total 180K drwxrwxrwx 15 www-data www-data 4.0K Mar 4 13:24 . drwxr-xr-x 3 root root 4.0K Feb 9 04:36 .. -rw-r--r-- 1 www-data www-data 3.2K Mar 4 13:24 .htaccess -rw-r--r-- 1 www-data www-data 101 Mar 4 13:24 .user.ini drwxr-xr-x 47 www-data www-data 4.0K Mar 4 13:24 3rdparty -rw-r--r-- 1 www-data www-data 19K Mar 4 13:24 AUTHORS -rw-r--r-- 1 www-data www-data 34K Mar 4 13:24 COPYING drwxr-xr-x 50 www-data www-data 4.0K Mar 4 13:24 apps drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 config -rw-r--r-- 1 www-data www-data 4.0K Mar 4 13:24 console.php drwxr-xr-x 23 www-data www-data 4.0K Mar 4 13:24 core -rw-r--r-- 1 www-data www-data 6.2K Mar 4 13:24 cron.php drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 custom_apps drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 data drwxr-xr-x 2 www-data www-data 12K Mar 4 13:24 dist -rw-r--r-- 1 www-data www-data 156 Mar 4 13:24 index.html -rw-r--r-- 1 www-data www-data 3.4K Mar 4 13:24 index.php drwxr-xr-x 6 www-data www-data 4.0K Mar 4 13:24 lib -rwxr-xr-x 1 www-data www-data 283 Mar 4 13:24 occ drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocm-provider drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs-provider -rw-r--r-- 1 www-data www-data 3.1K Mar 4 13:24 public.php -rw-r--r-- 1 www-data www-data 5.5K Mar 4 13:24 remote.php drwxr-xr-x 4 www-data www-data 4.0K Mar 4 13:24 resources -rw-r--r-- 1 www-data www-data 26 Mar 4 13:24 robots.txt -rw-r--r-- 1 www-data www-data 2.4K Mar 4 13:24 status.php drwxr-xr-x 3 www-data www-data 4.0K Mar 4 13:24 themes -rw-r--r-- 1 www-data www-data 383 Mar 4 13:24 version.php
NextCloud FPM 容器,記住安裝座已打開
/var/www/html
root@938c95d0e1ae:/var/www/html# ls -lha total 180K drwxrwxrwx 15 www-data www-data 4.0K Mar 4 13:24 . drwxrwxr-x 1 www-data root 4.0K Feb 16 03:06 .. -rw-r--r-- 1 www-data www-data 3.2K Mar 4 13:24 .htaccess -rw-r--r-- 1 www-data www-data 101 Mar 4 13:24 .user.ini drwxr-xr-x 47 www-data www-data 4.0K Mar 4 13:24 3rdparty -rw-r--r-- 1 www-data www-data 19K Mar 4 13:24 AUTHORS -rw-r--r-- 1 www-data www-data 34K Mar 4 13:24 COPYING drwxr-xr-x 50 www-data www-data 4.0K Mar 4 13:24 apps drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 config -rw-r--r-- 1 www-data www-data 4.0K Mar 4 13:24 console.php drwxr-xr-x 23 www-data www-data 4.0K Mar 4 13:24 core -rw-r--r-- 1 www-data www-data 6.2K Mar 4 13:24 cron.php drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 custom_apps drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 data drwxr-xr-x 2 www-data www-data 12K Mar 4 13:24 dist -rw-r--r-- 1 www-data www-data 156 Mar 4 13:24 index.html -rw-r--r-- 1 www-data www-data 3.4K Mar 4 13:24 index.php drwxr-xr-x 6 www-data www-data 4.0K Mar 4 13:24 lib -rwxr-xr-x 1 www-data www-data 283 Mar 4 13:24 occ drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocm-provider drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs-provider -rw-r--r-- 1 www-data www-data 3.1K Mar 4 13:24 public.php -rw-r--r-- 1 www-data www-data 5.5K Mar 4 13:24 remote.php drwxr-xr-x 4 www-data www-data 4.0K Mar 4 13:24 resources -rw-r--r-- 1 www-data www-data 26 Mar 4 13:24 robots.txt -rw-r--r-- 1 www-data www-data 2.4K Mar 4 13:24 status.php drwxr-xr-x 3 www-data www-data 4.0K Mar 4 13:24 themes -rw-r--r-- 1 www-data www-data 383 Mar 4 13:24 version.php
Docker 伺服器主機綁定掛載最後檢查 Docker 主機伺服器本身的文件,因為我不僅想實現共享兩個容器的根位置,如果我需要移動容器,還希望擁有持久性資料:
❯ ll total 180K drwxrwxrwx 15 www-data www-data 4.0K Mar 4 13:24 . drwxrwxr-x 10 Alejandro Alejandro 4.0K Mar 4 13:24 .. drwxr-xr-x 47 www-data www-data 4.0K Mar 4 13:24 3rdparty drwxr-xr-x 50 www-data www-data 4.0K Mar 4 13:24 apps -rw-r--r-- 1 www-data www-data 19K Mar 4 13:24 AUTHORS drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 config -rw-r--r-- 1 www-data www-data 4.0K Mar 4 13:24 console.php -rw-r--r-- 1 www-data www-data 34K Mar 4 13:24 COPYING drwxr-xr-x 23 www-data www-data 4.0K Mar 4 13:24 core -rw-r--r-- 1 www-data www-data 6.2K Mar 4 13:24 cron.php drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 custom_apps drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 data drwxr-xr-x 2 www-data www-data 12K Mar 4 13:24 dist -rw-r--r-- 1 www-data www-data 3.2K Mar 4 13:24 .htaccess -rw-r--r-- 1 www-data www-data 156 Mar 4 13:24 index.html -rw-r--r-- 1 www-data www-data 3.4K Mar 4 13:24 index.php drwxr-xr-x 6 www-data www-data 4.0K Mar 4 13:24 lib -rwxr-xr-x 1 www-data www-data 283 Mar 4 13:24 occ drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocm-provider drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs drwxr-xr-x 2 www-data www-data 4.0K Mar 4 13:24 ocs-provider -rw-r--r-- 1 www-data www-data 3.1K Mar 4 13:24 public.php -rw-r--r-- 1 www-data www-data 5.5K Mar 4 13:24 remote.php drwxr-xr-x 4 www-data www-data 4.0K Mar 4 13:24 resources -rw-r--r-- 1 www-data www-data 26 Mar 4 13:24 robots.txt -rw-r--r-- 1 www-data www-data 2.4K Mar 4 13:24 status.php drwxr-xr-x 3 www-data www-data 4.0K Mar 4 13:24 themes -rw-r--r-- 1 www-data www-data 101 Mar 4 13:24 .user.ini -rw-r--r-- 1 www-data www-data 383 Mar 4 13:24 version.php root@myserver /mnt/Volume/data/www
我看不出為什麼在許可方面它不起作用,並且已經確認這些文件在所有三個實例中都存在,因為它們應該存在。
檢查 NextCloud FPM nextcloud.conf 的 NGinX conf 文件,經過深思熟慮,我認為唯一可能是錯誤的,因為我透過瀏覽器上的網域一直到達 NGniX Web 伺服器容器,因為我有 404其日誌中未找到條目,我還從NextCloud Container 實例本身收到了404 個未找到的回應,我遇到的唯一問題與conf 檔案上的根條目有關:
下一篇雲日誌:
172.19.0.5 - 04/Mar/2023:22:36:01 +0000 "GET /index.php" 404
NGinX 日誌:
172.69.67.108 - - [04/Mar/2023:22:36:01 +0000] "GET / HTTP/2.0" 404 36 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" "xxx.my.ip.xxx"
所以我將 root 指令更改為
/var/www/html
,行為發生了一點變化,我仍然收到 404 Not Found 條目,但僅在 NGinX Web 伺服器容器日誌上,NextCloud 容器是靜默的,所以我沒有到達它有了這個改變:下一篇雲日誌(空無任何條目):
NGinX 日誌:
2023/03/05 00:13:24 [error] 473#473: *4152 "/var/www/html/index.php" is not found (2: No such file or directory), client: 172.69.65.73, server: nextcloud.example.com, request: "GET / HTTP/2.0", host: "nextcloud.example.com" 172.69.65.73 - - [05/Mar/2023:00:13:24 +0000] "GET / HTTP/2.0" 404 174 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" "xxx.my.ip.xxx"
Web 伺服器的行為方式有所不同,我注意到在 root 指令更改後,我看到日誌上引號之間的實際網域,
"nextcloud.example.com"
而之前只是一個破折號"-"
。接下來的事情是禁用 default.conf NGinX conf 文件,這是我能想到的唯一地方
"-"
,與上面相同的結果,我在我已經嘗試過的場景 1 和 2 上重複,它是一個"_"
on the server 指令default .conf 也是如此,所以是在黑暗中拍攝的。我已經嘗試了許多其他的conf設置,但大多數最終都是
Too Many Redirections
,,Bad Certificate
或者只是簡單的502
錯誤。
我對問題所在以及陷入困境的判斷
看來我非常接近我想要的結果,因為我從具有所需網域的瀏覽器存取兩個容器,並且 SSL 也解析得很好,但是,伺服器名稱似乎沒有被 NGinX conf 檔案捕獲,然後沒有正確傳遞給NextCloud,但我不知道到底要改什麼。
因為我認為我將範圍縮小到了我認為的具體問題,也許有人可以幫助我查看 NGinX conf 檔案 nextcloud.conf 並指出設定錯誤的地方。
謝謝你閱讀這篇長文章。
答案1
我想通了,所以我將提供詳細的信息,以幫助已經遇到同樣問題的人以及將來可能遇到此問題的人,考慮到我發現了多少關於此問題的問題和問題而沒有答案。
問題是 NGinX conf 檔案的 FastCGI 參數中的 FPM 根位置
所以我走在正確的軌道上,問題與根指令有關。
經過大量閱讀後,我偶然發現了這篇文章:
如何正確連結 php-fpm 和 Nginx Docker 容器?
突然間,我發現我有兩個不同的服務可以讀取兩個不同的路徑,其中一個服務正在向另一個不存在的根路徑提供資料。
還記得我已經安裝了 www 磁碟區以便在 2 個容器之間共用嗎?
- 對於 NGinX 容器
www:/usr/share/nginx/html
- 對於 NextCloud FPM 容器
www:/var/html/www
背後的想法是讓兩個容器共享 NextCloud 應用程式的檔案系統。
我沒有意識到的是,在此部署中,NGinX 的目的是提供靜態文件,如 CSS、HTML、JPG、JS 等,同時使用 FastCGI 參數將 PHP 呼叫路由到 NextCloud FPM 容器。
當 NGinX conf 檔案中的 root 指令被宣告時,它被設定為變數$document_root
。
root /usr/share/nginx/html;
因此,當將根設定為 NGinX 容器上的路徑時,/usr/share/nginx/html
這可以毫無問題地提供靜態文件,但是,當進行PHP 呼叫時,它會被饋送到NextCloud FPM 容器中的php-hanlder,因為該位置不存在存在於第二個容器內,它找不到 PHP 檔案。
為了解決這個問題,我搜尋了具有 FastCGI 參數的區塊並蒐索了$document_root
變量,找到了它,如下所示:
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
請注意該行如何fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
形成已宣告根的腳本路徑,因此在處理時nextcloud.example.com
它會嘗試讀取index.php
,這是對 NextCloud FPM 容器的呼叫結果:
/usr/share/nginx/html/index.php
正確的調用應該是:
/var/www/html/index.php
所以我創建了一個名為的新變數$fpm_root
並將其設定為/var/www/html/
,然後將行內容更改fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
為fastcgi_param SCRIPT_FILENAME $fpm_root$fastcgi_script_name;
現在,每當它收到對靜態內容的呼叫時,它都會解析 NGinX 的容器路徑,而當它收到對 PHP 內容的呼叫時,它會解析 NextCloud FPM 的容器路徑。
整個部分現在的樣子如下:
location ~ \.php(?:$|/) {
# Required for legacy support
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
set $fpm_root /var/www/html/;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fpm_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
一旦我添加了以下行,它現在就可以運行並通過所有內部 NextCloud 運行狀況和安全檢查:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
結論
我希望這可以幫助任何搜尋此問題的人,問題是我有兩種不同的路徑用於處理兩種類型的內容(靜態和 PHP)的服務,並且只有其中一個在 NGinX conf 檔案中正確設定。
您可以為dockerized FPM 部署擁有兩個不同(或更多)根位置,這可能可以使用相同的FPM 容器將靜態內容工作或部署到兩個或更多不同的應用程式中,以處理對NextCloud、WordPress 、PHPPGAdmin 的PHP 調用, Laravel 或任何你正在做的事情。