Can't connect to jetpack

October 14, 2016 264 views
WordPress Ubuntu 16.04

I've installed Wordpress from the droplet offered.

Jetpack is unable to connect - error below

SELF:
    Array
(
    [headers] => Requests_Utility_CaseInsensitiveDictionary Object
        (
            [data:protected] => Array
                (
                    [server] => nginx
                    [date] => Fri, 14 Oct 2016 05:55:12 GMT
                    [content-type] => text/plain;charset=utf-8
                    [expires] => Wed, 11 Jan 1984 05:00:00 GMT
                    [cache-control] => no-cache, must-revalidate, max-age=60
                    [x-hacker] => Jetpack Test
                    [x-ac] => 3.sjc _bur
                    [strict-transport-security] => max-age=15552000
                )

        )

    [body] => {"error":"XML-RPC is not responding correctly ( 500 )","error_description":"It looks like XML-RPC is not responding correctly. Please make sure XML-RPC is turned on for your site and is set up to respond to all content types. You can test this yourself by running the following command from the command line:<blockquote><code>curl -A 'Jetpack by WordPress.com' -d '<methodCall><methodName>demo.sayHello<\/methodName><\/methodCall>' http:\/\/www.raghav.io\/xmlrpc.php<\/code><\/blockquote><p>The answer should be:<\/p><blockquote><code><pre><?xml version="1.0" encoding="UTF-8"?>\n<methodResponse>\n  <params>\n    <param>\n      <value>\n      <string>Hello!<\/string>\n      <\/value>\n    <\/param>\n  <\/params>\n<\/methodResponse><\/pre><\/code><\/blockquote>"}
    [response] => Array
        (
            [code] => 400
            [message] => Bad Request
        )

    [cookies] => Array
        (
        )

    [filename] => 
    [http_response] => WP_HTTP_Requests_Response Object
        (
            [response:protected] => Requests_Response Object
                (
                    [body] => {"error":"XML-RPC is not responding correctly ( 500 )","error_description":"It looks like XML-RPC is not responding correctly. Please make sure XML-RPC is turned on for your site and is set up to respond to all content types. You can test this yourself by running the following command from the command line:<blockquote><code>curl -A 'Jetpack by WordPress.com' -d '<methodCall><methodName>demo.sayHello<\/methodName><\/methodCall>' http:\/\/www.raghav.io\/xmlrpc.php<\/code><\/blockquote><p>The answer should be:<\/p><blockquote><code><pre><?xml version="1.0" encoding="UTF-8"?>\n<methodResponse>\n  <params>\n    <param>\n      <value>\n      <string>Hello!<\/string>\n      <\/value>\n    <\/param>\n  <\/params>\n<\/methodResponse><\/pre><\/code><\/blockquote>"}
                    [raw] => HTTP/1.1 400 Bad Request
Server: nginx
Date: Fri, 14 Oct 2016 05:55:12 GMT
Content-Type: text/plain;charset=utf-8
Transfer-Encoding: chunked
Connection: close
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=60
X-hacker: Jetpack Test
X-ac: 3.sjc _bur
Strict-Transport-Security: max-age=15552000

36b
{"error":"XML-RPC is not responding correctly ( 500 )","error_description":"It looks like XML-RPC is not responding correctly. Please make sure XML-RPC is turned on for your site and is set up to respond to all content types. You can test this yourself by running the following command from the command line:<blockquote><code>curl -A 'Jetpack by WordPress.com' -d '<methodCall><methodName>demo.sayHello<\/methodName><\/methodCall>' http:\/\/www.raghav.io\/xmlrpc.php<\/code><\/blockquote><p>The answer should be:<\/p><blockquote><code><pre><?xml version="1.0" encoding="UTF-8"?>\n<methodResponse>\n  <params>\n    <param>\n      <value>\n      <string>Hello!<\/string>\n      <\/value>\n    <\/param>\n  <\/params>\n<\/methodResponse><\/pre><\/code><\/blockquote>"}
0


                    [headers] => Requests_Response_Headers Object
                        (
                            [data:protected] => Array
                                (
                                    [server] => Array
                                        (
                                            [0] => nginx
                                        )

                                    [date] => Array
                                        (
                                            [0] => Fri, 14 Oct 2016 05:55:12 GMT
                                        )

                                    [content-type] => Array
                                        (
                                            [0] => text/plain;charset=utf-8
                                        )

                                    [expires] => Array
                                        (
                                            [0] => Wed, 11 Jan 1984 05:00:00 GMT
                                        )

                                    [cache-control] => Array
                                        (
                                            [0] => no-cache, must-revalidate, max-age=60
                                        )

                                    [x-hacker] => Array
                                        (
                                            [0] => Jetpack Test
                                        )

                                    [x-ac] => Array
                                        (
                                            [0] => 3.sjc _bur
                                        )

                                    [strict-transport-security] => Array
                                        (
                                            [0] => max-age=15552000
                                        )

                                )

                        )

                    [status_code] => 400
                    [protocol_version] => 1.1
                    [success] => 
                    [redirects] => 0
                    [url] => https://jetpack.wordpress.com/jetpack.testsite/1/?url=http://raghav.io/xmlrpc.php
                    [history] => Array
                        (
                        )

                    [cookies] => Requests_Cookie_Jar Object
                        (
                            [cookies:protected] => Array
                                (
                                )

                        )

                )

            [filename:protected] => 
            [data] => 
            [headers] => 
            [status] => 
        )

)

after running curl -A 'Jetpack by WordPress.com' -d demo.sayHello mywebsite/xmlrpc.php

I get this method response

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>-32700</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>parse error. not well formed</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>
1 Answer

Our latest WordPress one-click includes fail2ban configured for WordPress which may be blocking connections to your xmlrpc.php file. To test this you can temporarily disable fail2ban with service fail2ban stop in order to verify if it is the cause of the problem.

On older one-clicks we included a configuration file to block xmlrpc.php but it was not enabled by default. This can be disabled with a2disconf block-xmlrpc

Have another answer? Share your knowledge.