Error message “An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.” is displayed at theme or plugin search.
This happens due to http request timeout which is defined in class-http.php under wp-include directory. Default timeout (5 seconds) is sometimes too short to load the theme or plugin contents. All you need to do is increase it.
$ sudo vi /var/www/html/wp-includes/class-http.php
-Increase timeout value from 5 to whatever
'timeout' => apply_filters( 'http_request_timeout', 15 ),