WordPress – error:1408F10B on API calls.

Wordpress API Curl Nginx Ubuntu

I recently set up a new server for a WordPress website. I prepared it following the same process as always: Ubuntu 20.04 as the operating system, Nginx as the web server, PHP 7.4, and MariaDB for the database. I configured everything and setup the databases, permissions and accesses, and installed WordPress.

Once installed, when I was about to install plugins and prepare the environment, I ran into this error:

curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

WordPress couldn’t connect to itself using API calls, used to run scheduled tasks (wp-cron) or background tasks. This seemed quite strange so I began to investigate. I searched the internet and some of the possible causes were:

  • That the cURL library (libcurl) was not installed and/or activated.
  • That there were different versions of PHP installed interfering with each other.
  • That the server block in the Nginx configuration was missing the ssl directive.

All of these are very easy to fix, but none of them were in my case.

After researching a little more and several more tests I found the solution, which in the end was just as simple to fix as the problems mentioned above.

Add the domain (s) used by the web to the /etc/hosts file. You simply add a line with the local IP of the server, and the domain name (s) that the page will use, for example: kevinmaschke.com www.kevinmaschke.com

Once this was done, I restarted the server just in case and violà! The error no longer appeared.

Extra little tip for WordPress

It is well known that the use of the cron controller integrated in WordPress can affect the loading times of the web page, so it is recommended to disable it adding the following line to the wp-config.php file:

define('DISABLE_WP_CRON', 'true');

And run these scheduled tasks in the background through the operating system itself. To do this, in Ubuntu, we edit CRON using the crontab -e command and add the following line:

*/5 * * * * cd /var/www/kevinmaschke.com/public; /usr/local/bin/wp cron event run --due-now >/dev/null 2>&1

It is important to remember that for this to work you need to have the WP-CLI installed.

More Stories
A movieish Weekend in Chicago.