When running WordPress, you might encounter this warning in your Site Health Check page: REST API ErrorThe REST API is one way WordPress and other applications communicate with the server. Error: (http_request_failed) cURL error 28: Connection timed out after 10001 milliseconds This message indicates that your WordPress instance failed to communicate with itself through the…
Category: Docker
About Docker Command
解決 WordPress REST API 錯誤:cURL error 28 的實戰過程
在使用 WordPress 時,如果在「網站健康檢查」頁面看到以下訊息: REST API 發生錯誤REST API 是 WordPress 及其他應用程式與伺服器進行通訊的一種方式。以區塊編輯器畫面為例,它便是依賴 REST API 來顯示與儲存內容。測試 REST API 時發生錯誤:REST API 回應: (http_request_failed) cURL error 28: Connection timed out after 10001 milliseconds 代表你的 WordPress 無法透過內部網路與自己通訊。這種錯誤看似奇怪,實際上非常常見,尤其當你的網站部署在 Docker 或反向代理環境 中。 🔍 問題現象 WordPress 會在檢查 REST API 時,嘗試透過 HTTP 請求連到自己的網址(例如 https://www.nuface.tw/wp-json/)。但如果容器內的 DNS 無法解析這個網域,就會出現逾時錯誤 cURL error 28。 簡單來說,就是「WordPress 呼叫自己時,找不到自己」。 🧠 問題原因分析 在 Docker…
Integrating Apache with a PHP-FPM Container
🔰 Introduction In many containerized environments, it’s common to run Apache in one container and PHP-FPM in another.By default, an Apache container that serves only static files (HTML, CSS, JS) won’t execute PHP scripts because it lacks the PHP runtime. If you’ve started a separate PHP-FPM container, you can configure Apache to forward all .php…
Apache 整合 PHP-FPM 容器
🔰 前言 在容器化環境中,常見的架構是將 Apache 與 PHP-FPM 分開成兩個容器執行。Apache 容器負責靜態內容(HTML、CSS、JS)與 HTTP 請求處理,而 PHP-FPM 容器則負責 PHP 程式的執行。 若你的 Apache 容器目前僅能顯示靜態頁面(無法執行 PHP 程式),可以透過設定 Apache 的網站組態檔,將 .php 檔案交由 PHP-FPM 容器 處理。本文將說明整合步驟與注意事項。 🧩 環境假設 假設目前有以下環境: ⚙️ 步驟一:確認網路連線 首先確認 Apache 與 PHP-FPM 是否在同一個網路中: 如果未在同一網段,可手動加入: ⚙️ 步驟二:啟用 Apache 代理模組 在 Apache 容器中啟用以下模組: 啟用後重新啟動 Apache: ⚙️ 步驟三:修改 Apache 網站設定檔 編輯網站設定檔(例如 /etc/apache2/sites-available/000-default.conf),在 <VirtualHost> 區塊內加入以下設定: 設定說明:…
Docker Network Create
When creating a Docker network, you can specify a custom subnet and gateway using the docker network create command with the –subnet and –gateway parameters. 🧩 Example Command 🔍 Explanation Parameter Description –driver=bridge Specifies the network driver. The default is bridge. While optional, it’s good practice to include it explicitly. –subnet=172.24.0.0/16 Defines the IP subnet…
Docker 建立特定網段
建立Docker Network 時指定網段及Gateway 的指令。建立一個自訂的 Docker 網路,指定 subnet 與 gateway,可以用 docker network create 搭配 –subnet 與 –gateway 參數。 範例如下: 說明: –driver=bridge → 預設就是 bridge,可以省略,但建議寫明。–subnet=172.24.0.0/16 → 指定網段。–gateway=172.24.0.1 → 指定網路閘道。mail-network → 網路名稱。 建立好之後可以確認: 會看到類似: