{"id":5154,"date":"2020-03-07T17:45:28","date_gmt":"2020-03-07T14:45:28","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5154"},"modified":"2022-05-26T20:13:00","modified_gmt":"2022-05-26T17:13:00","slug":"how-to-fix-wordpress-could-not-establish-a-secure-connection-to-wordpress-org","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-fix-wordpress-could-not-establish-a-secure-connection-to-wordpress-org\/","title":{"rendered":"How to fix WordPress could not establish a secure connection to WordPress.org"},"content":{"rendered":"\n
Are you looking for a solution on how to fix WordPress could not establish a secure connection to WordPress.org error appearing on your WordPress dashboard?<\/p>\n\n\n\n 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<\/a>. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)<\/strong><\/p><\/blockquote><\/figure>\n\n\n\n Are you using WordPress and looking for a professional WordPress website builder? Look no further since Elementor can help you create beautiful pages<\/a>.<\/p>\n\n\n\n The same above can also be seen on the logs;<\/p>\n\n\n\n So what causes this error?<\/p>\n\n\n\n WordPress comes bundled with mechanisms to contact WordPress REST API from where it can fetch the updates including WordPress core updates, plugins and themes updates.<\/p>\n\n\n\n When the updates are available, WordPress is able to display the notifications about respective updates.<\/p>\n\n\n\n In the event that WordPress is unable to connect to WordPress sites to fetch this information, you may encounter such an error.<\/p>\n\n\n\n Well, there are quite a number of suggested solutions online that explains how to fix this error including;<\/p>\n\n\n\n However, there is one solution that stood out and helped me fixed this issue from WordPress support forum.<\/p>\n\n\n\n If you’re interested in reading 100s of more WordPress tips and tricks visit Collectiveray.com<\/a>.<\/p>\n\n\n\n Disclaimer:<\/strong> I can’t guarantee that this solution will work for you as the solution itself is not my own discovery. Just try your best. To add to this, if you aren\u2019t tech-savvy, you should look into how to find a good WordPress developer<\/a> that can solve the secure connection issue for you. It\u2019s more than worth it, because you know it\u2019ll get taken care of, risk-free.<\/p>\n\n\n\n The solution provided suggested that you have to edit the WordPress To implement the suggested solution, first create a backup of your wordpress Next open the file for editing and add the following configurations at the end of the file.<\/p>\n\n\n\n Where XXX.XXX.XXX.XXX is the respective IP address of the provided domains.<\/p>\n\n\n\n Get the IP addresses of the api.wordpress.org and downloads.wordpress.org domains.<\/p>\n\n\n\n Update the configuration such that it looks like in below with the IP addresses updated.<\/p>\n\n\n\n Save and quit the configuration file.<\/p>\n\n\n\n Ensure that no firewall blocks connections to these sites.<\/p>\n\n\n\n Next, restart your web server. <\/p>\n\n\n\n Ensure that no errors before restarting the web server.<\/p>\n\n\n\n The restart;<\/p>\n\n\n\n And phew, the error disappears on your WordPress dashboard. That is just it on how to WordPress could not establish a secure connection to WordPress.org<\/p>\n\n\n\n We hope this helped someone too.<\/p>\n\n\n\n Read more on the reference link below;<\/p>\n\n\n\n Error: WordPress could not establish a secure connection to WordPress.org<\/a><\/p>\n\n\n\n Related tutorials<\/p>\n\n\n\n Install WordPress with Nginx and MySQL 8 on CentOS 8<\/a><\/p>\n\n\n\n Install WordPress 5 with Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n Install WordPress 5 with Nginx on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n Install WordPress 5.x with Apache on Fedora 29\/Fedora 28<\/a><\/p>\n\n\n\ntail \/var\/log\/nginx\/kifarunix-demo.error.log<\/code><\/pre>\n\n\n\n
...\n2020\/03\/07 15:18:42 [error] 23961#23961: *3353 FastCGI sent in stderr: \"PHP message: PHP Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server\u2019s configuration. If you continue to have problems, please try the support forums<\/a>. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.<\/strong>) in \/var\/www\/html\/app.kifarunix-demo.com\/wp-includes\/update.php on line 380\" while reading upstream, client: 192.168.56.1, server: app.kifarunix-demo.com, request: \"POST \/wp-admin\/update.php?action=upload-plugin HTTP\/1.1\", upstream: \"fastcgi:\/\/127.0.0.1:9000\", host: \"app.kifarunix-demo.com\", referrer: \"https:\/\/app.kifarunix-demo.com\/wp-admin\/plugin-install.php\"\n...<\/code><\/pre>\n\n\n\n
api.wordpress.org<\/code> or
downloads.wordpress.org<\/code>.<\/li>
api.wordpress.org<\/code> or
downloads.wordpress.org<\/code> sites are resolvable by your DNS<\/li>
openssl<\/strong><\/code> command installed.<\/li>
How to fix WordPress could not establish a secure connection to WordPress.org<\/h2>\n\n\n\n
cURL.php<\/strong><\/code> configuration and set an option for transfer to define a custom address on how WordPress can connect to
api.wordpress.org<\/strong><\/code> and
downloads.wordpress.org<\/strong><\/code> using both HTTP and HTTPS connections.<\/p>\n\n\n\n
cURL.php<\/code> configuration file.<\/p>\n\n\n\n
cp \/var\/www\/html\/app.kifarunix-demo.com\/wp-includes\/Requests\/Transport\/cURL.php \/var\/www\/html\/app.kifarunix-demo.com\/wp-includes\/Requests\/Transport\/cURL.php.old<\/code><\/pre>\n\n\n\n
vim cp \/var\/www\/html\/app.kifarunix-demo.com\/wp-includes\/Requests\/Transport\/cURL.php<\/code><\/pre>\n\n\n\n
...\nadd_action('http_api_curl', 'custom_curl_resolve', 10, 3 );\nfunction custom_curl_resolve( $handle, $r, $url ) {\n\tcurl_setopt($handle, CURLOPT_RESOLVE, array(\n\t\t\"api.wordpress.org:80:XXX.XXX.XXX.XXX\", \n\t\t\"api.wordpress.org:443:XXX.XXX.XXX.XXX\", \n\t\t\"downloads.wordpress.org:80:XXX.XXX.XXX.XXX\", \n\t\t\"downloads.wordpress.org:443:XXX.XXX.XXX.XXX\")\n\t);\n}\n<\/code><\/pre>\n\n\n\n
dig +short api.wordpress.org<\/code><\/pre>\n\n\n\n
198.143.164.251<\/code><\/pre>\n\n\n\n
dig +short downloads.wordpress.org<\/code><\/pre>\n\n\n\n
198.143.164.250<\/code><\/pre>\n\n\n\n
add_action('http_api_curl', 'custom_curl_resolve', 10, 3 );\nfunction custom_curl_resolve( $handle, $r, $url ) {\n\tcurl_setopt($handle, CURLOPT_RESOLVE, array(\n\t\t\"api.wordpress.org:80:198.143.164.251\", \n\t\t\"api.wordpress.org:443:198.143.164.251\", \n\t\t\"downloads.wordpress.org:80:198.143.164.250\", \n\t\t\"downloads.wordpress.org:443:198.143.164.250\")\n\t);\n}\n<\/code><\/pre>\n\n\n\n
curl https:\/\/api.wordpress.org -I<\/code><\/pre>\n\n\n\n
HTTP\/1.1 302 Found\nServer: nginx\nDate: Sat, 07 Mar 2020 14:32:45 GMT\nContent-Type: text\/html; charset=utf-8\nConnection: keep-alive\nLocation: https:\/\/developer.wordpress.org\/rest-api\/\nX-Frame-Options: SAMEORIGIN\n<\/code><\/pre>\n\n\n\n
curl http:\/\/api.wordpress.org -I<\/code><\/pre>\n\n\n\n
HTTP\/1.1 302 Found\nServer: nginx\nDate: Sat, 07 Mar 2020 14:33:59 GMT\nContent-Type: text\/html; charset=utf-8\nConnection: keep-alive\nLocation: https:\/\/developer.wordpress.org\/rest-api\/\nX-Frame-Options: SAMEORIGIN\n<\/code><\/pre>\n\n\n\n
curl http:\/\/downloads.wordpress.org -I<\/code><\/pre>\n\n\n\n
HTTP\/1.1 301 Moved Permanently\nServer: nginx\nDate: Sat, 07 Mar 2020 14:34:39 GMT\nContent-Type: text\/html\nContent-Length: 162\nConnection: keep-alive\nLocation: https:\/\/downloads.wordpress.org\/\n<\/code><\/pre>\n\n\n\n
curl https:\/\/downloads.wordpress.org -I<\/code><\/pre>\n\n\n\n
HTTP\/1.1 302 Moved Temporarily\nServer: nginx\nDate: Sat, 07 Mar 2020 14:36:18 GMT\nContent-Type: text\/html\nContent-Length: 138\nConnection: keep-alive\nLocation: https:\/\/wordpress.org\/download\/\nX-Frame-Options: SAMEORIGIN\nX-nc: HIT ord 6\n<\/code><\/pre>\n\n\n\n
nginx -t<\/code><\/pre>\n\n\n\n
httpd -t<\/code><\/pre>\n\n\n\n
apachectl configtest<\/code><\/pre>\n\n\n\n
systemctl restart nginx<\/code><\/pre>\n\n\n\n
systemctl restart httpd<\/code><\/pre>\n\n\n\n