Wordpress / 站点运行状况 / REST API 错误 / 环回错误

问题描述 投票:0回答:4

你好吗? 当我使用本机 WordPress 站点运行状况功能时,我收到两个错误。

Your site could not complete a loopback request

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 35: OpenSSL SSL_connect: Connection reset by peer in connection to mydomain.com:443 (http_request_failed)

The REST API encountered an error

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

The REST API request failed due to an error.
Error: cURL error 35: OpenSSL SSL_connect: Connection reset by peer in connection to mydomain.com:443 (http_request_failed)

已经做了:

  • 我禁用了所有插件。
  • 我更改为默认主题。
  • 我随意禁用了 CSF 和 ModSecurity。

但没有成功。 我该如何解决这个问题?

wordpress openssl loopback wordpress-rest-api csf
4个回答
6
投票

我在本地开发环境中遇到了同样的两个关键问题。

我的 WordPress 站点默认地址为“http://localhost:8000”,在本地 docker 容器中运行,将 extra_hosts 部分添加到 docker-compose.yml 后,问题解决了。

这是正在运行的 docker-compose.yml

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
       WORDPRESS_DB_NAME: wordpress
     extra_hosts:
       - "localhost:172.18.0.1"
volumes:
    db_data: {}

请注意,172.18.0.1 是默认的 docker 网关。


0
投票

我自己托管 WordPress 时遇到了这个问题。

这是由我的网络设置引起的。如果您使用 NAT 或您自己的 DNS,您将需要执行 NAT 反射或拆分 DNS。

您最好的选择是拆分 DNS。 (您可以根据自己的网络服务器查找如何执行此操作。)

您可以从 NetGate 找到更多信息 如果使用 PFSense 这将解决您的问题。或者希望为您指明正确的方向。

https://docs.netgate.com/pfsense/en/latest/nat/reflection.html


0
投票

就我而言,我在 Windows 上运行 Wordpress,并使用 nginx 和 php-cgi.exe 作为服务。 经过一些调试后,我意识到 php-cgi 服务一次只接受一个连接。 我必须设置以下环境变量,以便 php-cgi 服务可以处理更多请求:

PHP_FCGI_MAX_REQUESTS=0
PHP_FCGI_CHILDREN=10

这解决了健康检查页面中的环回错误。


0
投票

我尝试了@derek.z 的解决方案,但没有成功。在

.htaccess
中评论这些行修复了这 2 个错误:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

这 3 行是永久链接的规则(当使用 /%postname%/ 时)。评论它们确实会破坏您的网站,因为没有页面可以再显示。但它解决了100%以下的2个错误:

  • 您的站点无法完成环回请求
  • 无法检测页面缓存的存在

这绝不是一个有效的解决方案,而是构建解决方案的另一块砖。

© www.soinside.com 2019 - 2024. All rights reserved.