demyxsh / demyx

Demyx is a Docker image that automates and manages WordPress installations. Traefik for reverse proxy with Lets Encrypt SSL/TLS. WordPress sites are powered by OpenLiteSpeed/NGINX-PHP and MariaDB.
https://demyx.sh
MIT License
144 stars 23 forks source link

WordPress loopback and Rest API error #33

Closed ali3nz closed 1 year ago

ali3nz commented 1 year ago

Hi there, I am encountering these 2 critical errors showing under site health in WordPress when using demyx to have run up a WordPress site on a Digital Ocean Droplet.

2 GB Memory / 2 AMD vCPUs / 25 GB Disk / SYD1 - Docker 23.0.6 on Ubuntu 22.04

1.) The REST API encountered an error

Performance The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.

When testing the REST API, an error was encountered:

REST API Endpoint: https://smarthomenz.com/wp-json/wp/v2/types/post?context=edit REST API Response: (http_request_failed) cURL error 28: Connection timed out after 10002 milliseconds

2.) Your site could not complete a loopback request

Performance Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.

The loopback request to your site failed, this means features relying on them are not currently working as expected. Error: cURL error 28: Connection timed out after 10002 milliseconds (http_request_failed)

demyxco commented 1 year ago

I'm gonna assume you are using Docker One-Click Droplet from DigitalOcean's marketplace? If so, then the culprit is going to be ufw. That particular droplet is shipped with ufw and configured to close all ports except 3. Running below will show you that:

# ufw status

ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     LIMIT       Anywhere
2375/tcp                   ALLOW       Anywhere
2376/tcp                   ALLOW       Anywhere
22/tcp (v6)                LIMIT       Anywhere (v6)
2375/tcp (v6)              ALLOW       Anywhere (v6)
2376/tcp (v6)              ALLOW       Anywhere (v6)

So we need to open up ports 80 and 443 by chaining the two commands ufw allow 80; ufw allow 443 and that should resolve the issue.

ali3nz commented 1 year ago

I can confirm you are absolutely correct and the command you have given resolved the issue. Thanks so much!