{"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<p>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<figure class=\"wp-block-pullquote\"><blockquote><p><strong>An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href=\"https:\/\/wordpress.org\/support\/\" target=\"_blank\" rel=\"noopener\">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<p>Are you using WordPress and looking for a professional WordPress website builder? Look no further since <a href=\"https:\/\/trk.elementor.com\/8uczdzzsxgza-webcreatorsred\" target=\"_blank\" rel=\"noreferrer noopener\">Elementor can help you create beautiful pages<\/a>.<\/p>\n\n\n\n<p>The same above can also be seen on the logs;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>tail \/var\/log\/nginx\/kifarunix-demo.error.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>...\n2020\/03\/07 15:18:42 [error] 23961#23961: *3353 FastCGI sent in stderr: \"<strong>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 <a href=\"https:\/\/wordpress.org\/support\/\" target=\"_blank\" rel=\"noopener\">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<p>So what causes this error?<\/p>\n\n\n\n<p>WordPress comes bundled with mechanisms to contact&nbsp;WordPress REST API&nbsp;from where it can fetch the updates including WordPress core updates, plugins and themes updates.<\/p>\n\n\n\n<p>When the updates are available, WordPress is able to display the notifications about respective updates.<\/p>\n\n\n\n<p>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<p>Well, there are quite a number of suggested solutions online that explains how to fix this error including;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Ensuring that curl (PHP extension) is installed<\/li><li>Ensuring that no firewall blocks connection to <code>api.wordpress.org<\/code> or <code>downloads.wordpress.org<\/code>.<\/li><li>Ensuring that the <code>api.wordpress.org<\/code> or <code>downloads.wordpress.org<\/code> sites are resolvable by your DNS<\/li><li>Ensuring that your have the latest version of <code><strong>openssl<\/strong><\/code> command installed.<\/li><li>No SELinux related issues<\/li><li>and many other solutions<\/li><\/ul>\n\n\n\n<p>However, there is one solution that stood out and helped me fixed this issue from WordPress support forum.<\/p>\n\n\n\n<p>If you&#8217;re interested in reading 100s of more WordPress tips and tricks <a href=\"https:\/\/www.collectiveray.com\/wordpress-tips-tricks-hacks\" target=\"_blank\" aria-label=\"visit Collectiveray.com (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"rank-math-link\">visit Collectiveray.com<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to fix WordPress could not establish a secure connection to WordPress.org<\/h2>\n\n\n\n<p class=\"has-normal-font-size\"><strong>Disclaimer:<\/strong> I can&#8217;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 <a href=\"https:\/\/site-steward.com\/find-a-wordpress-developer\" target=\"_blank\" rel=\"noreferrer noopener\">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<p>The solution provided suggested that you have to edit the WordPress <code><strong>cURL.php<\/strong><\/code> configuration and set an option for transfer to define a custom address on how WordPress can connect to <code><strong>api.wordpress.org<\/strong><\/code> and <code><strong>downloads.wordpress.org<\/strong><\/code> using both HTTP and HTTPS connections.<\/p>\n\n\n\n<p>To implement the suggested solution, first create a backup of your wordpress <code>cURL.php<\/code> configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>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<p>Next open the file for editing and add the following configurations at the end of the file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim cp \/var\/www\/html\/app.kifarunix-demo.com\/wp-includes\/Requests\/Transport\/cURL.php<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>...\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<p>Where XXX.XXX.XXX.XXX is the respective IP address of the provided domains.<\/p>\n\n\n\n<p>Get the IP addresses of the api.wordpress.org and downloads.wordpress.org domains.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dig +short api.wordpress.org<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>198.143.164.251<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dig +short downloads.wordpress.org<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>198.143.164.250<\/code><\/pre>\n\n\n\n<p>Update the configuration such that it looks like in below with the IP addresses updated.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>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<p>Save and quit the configuration file.<\/p>\n\n\n\n<p>Ensure that no firewall blocks connections to these sites.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>curl https:\/\/api.wordpress.org -I<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>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<pre class=\"wp-block-preformatted\"><code>curl http:\/\/api.wordpress.org -I<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>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<pre class=\"wp-block-preformatted\"><code>curl http:\/\/downloads.wordpress.org -I<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>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<pre class=\"wp-block-preformatted\"><code>curl https:\/\/downloads.wordpress.org -I<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>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<p>Next, restart your web server. <\/p>\n\n\n\n<p>Ensure that no errors before restarting the web server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nginx -t<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>httpd -t<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apachectl configtest<\/code><\/pre>\n\n\n\n<p>The restart;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart nginx<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart httpd<\/code><\/pre>\n\n\n\n<p>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<p>We hope this helped someone too.<\/p>\n\n\n\n<p>Read more on the reference link below;<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\"Error: WordPress could not establish a secure connection to WordPress.org (opens in a new tab)\" href=\"https:\/\/wordpress.org\/support\/topic\/error-wordpress-could-not-establish-a-secure-connection-to-wordpress-org\/\" target=\"_blank\">Error: WordPress could not establish a secure connection to WordPress.org<\/a><\/p>\n\n\n\n<p>Related tutorials<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-wordpress-with-nginx-and-mysql-8-on-centos-8\/\" target=\"_blank\">Install WordPress with Nginx and MySQL 8 on CentOS 8<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-wordpress-5-with-nginx-on-debian-10-buster\/\" target=\"_blank\">Install WordPress 5 with Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-wordpress-5-with-nginx-on-fedora-30-fedora-29\/\" target=\"_blank\">Install WordPress 5 with Nginx on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-wordpress-5-0-with-apache-on-fedora-29-fedora-28\/\" target=\"_blank\">Install WordPress 5.x with Apache on Fedora 29\/Fedora 28<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-use-wpscan-wordpress-vulnerability-scanner-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Install and Use WPScan WordPress Vulnerability Scanner Ubuntu 18.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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","protected":false},"author":1,"featured_media":12664,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[292,121,34],"tags":[3066,1321,1319,1318,1320],"class_list":["post-5154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-howtos","category-security","tag-fix-wordpress-could-not-establish-secure-connection-to-wordpress-org","tag-secure-connection","tag-wordpress-could-not-establish-a-secure-connection","tag-wordpress-could-not-establish-a-secure-connection-to-wordpress-org","tag-wordpress-errors","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5154"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5154"}],"version-history":[{"count":6,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5154\/revisions"}],"predecessor-version":[{"id":12931,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5154\/revisions\/12931"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12664"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}