Join the community today
Register Now

Wordpress cURL error 7

Discussion in 'Blogs & CMS usage' started by Cleber, May 28, 2020.

  1. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
    hello guys, i have a website installed on a vps, and i installed centminmod, i have cloudflare as Dns, and when i enter the diagnostic page, give this API error Rest: Error: cURL error 7: Failed connect to sabedenada.com: 443; Connection refused (http_request_failed) my configuration in the cloudflare ssl is Flexible, I changed it to full but the site was down, can someone help me?
     
  2. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  3. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
    All tast, B Grade, but i put comand curl mydomain.com i got a error connection recuse on port 443, how i fix this API REST error code
     
  4. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
  5. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    which webhost/plan you use ?

    Your domain sabedenada.com ?

    what is output for SSH commands
    Code (Text):
    virt-what

    Code (Text):
    lscpu

    Code (Text):
    perl /etc/csf/csftest.pl
    

    Code (Text):
    curl -Ivk https://sabedenada.com
    

    and
    Code (Text):
    curl -Ivk https://www.sabedenada.com
    

    for posting code or output from commands to keep the formatting, you might want to use CODE tags for code How to use forum BBCODE code tags :)

    If you use a reverse proxy like Cloudflare, Sucuri, or Incapsula in front of Centmin Mod Nginx, you need to setup nginx realip to be passed onto Nginx.

    See Getting Started Guide step 5 and setting correct real ip via nginx module config at http://centminmod.com/nginx_configure_cloudflare.html. The tools/csfcf.sh cronjob mentioned below helps maintain the whitelisted CSF Firewall IPs, but you still need to setup nginx realip in your nginx vhost.

    If using Centmin Mod 123.09beta01 and newer, there's an added tools/csfcf.sh script to aid in this. Details at:
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    also make sure server's /etc/hosts doesn't have an entry for your domain that overrides DNS with a local IP

    what's output for
    Code (Text):
    cat /etc/hosts

    you can mask any real server IPs in output to not reveal server IP.
     
  7. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
     
  8. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Code (Text):
    * About to connect() to sabedenada.com port 443 (#0)
    * Trying 104.223.109.124...
    * Connection refused
    * Failed connect to sabedenada.com:443; Connection refused
    * Closing connection 0
    curl: (7) Failed connect to sabedenada.com:443; Connection refuse
    d

    for non-www domain seems to be issue as www version works

    did you ensure to have DNS A record for both non-www and www version of your domain ?

    Code (Text):
    curl -Ivk https://www.sabedenada.com
    * About to connect() to www.sabedenada.com port 443 (#0)
    *   Trying 104.31.80.207...
    * Connected to www.sabedenada.com (104.31.80.207) port 443 (#0)
    * Initializing NSS with certpath: sql:/etc/pki/nssdb
    * skipping SSL peer certificate verification
    * SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
    * Server certificate:
    *       subject: CN=sni.cloudflaressl.com,O="Cloudflare, Inc.",L=
    San Francisco,ST=CA,C=US
    *       start date: Feb 04 00:00:00 2020 GMT
    *       expire date: Oct 09 12:00:00 2020 GMT
    *       common name: sni.cloudflaressl.com
    *       issuer: CN=CloudFlare Inc ECC CA-2,O="CloudFlare, Inc.",L
    =San Francisco,ST=CA,C=US
    > HEAD / HTTP/1.1
    > User-Agent: curl/7.29.0
    > Host: www.sabedenada.com
    > Accept: */*
    >
    < HTTP/1.1 301 Moved Permanently
    HTTP/1.1 301 Moved Permanently
    < Date: Wed, 27 May 2020 21:15:52 GMT
    Date: Wed, 27 May 2020 21:15:52 GMT
    < Content-Type: text/html; charset=UTF-8
    Content-Type: text/html; charset=UTF-8
    < Connection: keep-alive
    Connection: keep-alive
    < Set-Cookie: __cfduid=d676c148751904ca9c14ff6dc72a43e4a159061415
    2; expires=Fri, 26-Jun-20 21:15:52 GMT; path=/; domain=.sabedenad
    a.com; HttpOnly; SameSite=Lax; Secure
    Set-Cookie: __cfduid=d676c148751904ca9c14ff6dc72a43e4a1590614152;
     expires=Fri, 26-Jun-20 21:15:52 GMT; path=/; domain=.sabedenada.
    com; HttpOnly; SameSite=Lax; Secure
    < Set-Cookie: PHPSESSID=t34hgkuios13h6t0npshhqhgoa; path=/
    Set-Cookie: PHPSESSID=t34hgkuios13h6t0npshhqhgoa; path=/
    < Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    < Cache-Control: no-store, no-cache, must-revalidate
    Cache-Control: no-store, no-cache, must-revalidate
    < Pragma: no-cache
    Pragma: no-cache
    < Vary: Accept-Encoding, Cookie
    Vary: Accept-Encoding, Cookie
    < X-Redirect-By: WordPress
    X-Redirect-By: WordPress
    < Location: https://sabedenada.com/
    Location: https://sabedenada.com/
    < X-Powered-By: centminmod
    X-Powered-By: centminmod
    < X-Xss-Protection: 1; mode=block
    X-Xss-Protection: 1; mode=block
    < X-Content-Type-Options: nosniff
    X-Content-Type-Options: nosniff
    < CF-Cache-Status: DYNAMIC
    CF-Cache-Status: DYNAMIC
    < cf-request-id: 02f996ee4b00000e429128d200000001
    cf-request-id: 02f996ee4b00000e429128d200000001
    < Expect-CT: max-age=604800, report-uri="https://report-uri.cloud
    flare.com/cdn-cgi/beacon/expect-ct"
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudfl
    are.com/cdn-cgi/beacon/expect-ct"
    < Server: cloudflare
    Server: cloudflare
    < CF-RAY: 59a2c0f6d9760e42-DFW
    CF-RAY: 59a2c0f6d9760e42-DFW
    
    <
    * Connection #0 to host www.sabedenada.com left intact

    seems 301 redirect from www to non-www made by wordpress itself

    which is your intended main domain ? www or non-www version ? seems wordpress settings as non-www version set as siteurl?

    What's output for these commands changing /home/nginx/domains/domain.com/public/ to the path to where you installed wordpress i.e. if domain.com/blog then it would be /home/nginx/domains/domain.com/public/blog
    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp option get siteurl --allow-root
    wp option get home --allow-root
    

    If siteurl and home values are coming up with non-www and you want www being the main destination you can change them in your wordpress generation url settings or more thoroughly via wp-cli command line
    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp search-replace 'https://example.com' 'https://www.example.com' --skip-columns=guid
    

    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp option update home 'https://www.example.com'
    wp option update siteurl 'https://www.example.com'
    

    And same in reverse, if siteurl and home values are coming up with www and you want non-www being the main destination you can change them in your wordpress generation url settings or more thoroughly via wp-cli command line
    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp search-replace 'https://www.example.com' 'https://example.com' --skip-columns=guid
    

    Code (Text):
    cd /home/nginx/domains/domain.com/public/
    wp option update home 'https://example.com'
    wp option update siteurl 'https://example.com'
    
     
  9. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
    Good morning, i try this comands, later i post resulta, thks
     
  10. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
    Code:
    Erro: cURL error 28: Operation timed out after 10001 milliseconds with 0 out of -1 bytes received (http_request_failed)
    Its works, but now show another error:
     
  11. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  12. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
  13. eva2000

    eva2000 Administrator Staff Member

    44,525
    10,170
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,742
    Local Time:
    2:46 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    did you install any additional wordpress plugins since wordpress site was created ? try disabling the additional wp plugins and purge cloudflare cache and see
     
  14. Cleber

    Cleber New Member

    9
    1
    3
    May 28, 2020
    Ratings:
    +1
    Local Time:
    1:46 PM
    1.17
    Maria então 5.5
    All works thanks