Hello, friends. When an error happens on WordPress, it’s a total headache. Something is wrong, and occasionally, we have no idea what could have happened. Today you will learn how to resolve the error “An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration” on WordPress.
The causes
This error on WordPress happens when there is a problem in the domain name resolution of the WordPress servers and specifically in the API.
This causes that even when you want to install a new theme, it will give the same and suggests us to go to the forums to solve the problem.
However, the solution is simple but requires a bit of work.
Let’s start with
How to solve “An unexpected error occurred…server’s configuration” on WordPress
Step 1: Disable SELinux
To resolve this error, we need to do two things.
The first is to disable SELinux from the system. To achieve this, open up a text editor and edit the SELinux configuration.
sudo vi /etc/selinux/config
And change:
SELINUX=enforcing
To this line
SELINUX=disabled
Save the changes and exit the editor. To apply the changes, reboot the system.
Step 2: Install Bind
The issue is in the domain name resolution, so to solve it, you have to install bind.
On systems such as Debian, Ubuntu and derivatives, then, you can run
sudo apt update
sudo apt upgrade
sudo apt install bind9 bind9-utils
But on RHEL-based systems
sudo dnf -y install bind-utils
Please consider adding this entry to /etc/hosts, but It’s not really required.
198.143.164.251 api.wordpress.org
Reboot the system, and now you should have the difficulty solved.
Conclusion
In this post, you learned how to fix a serious bug inside WordPress. This error can cause you a headache, but with a fairly simple solution.