How to connect Jetpack to a MAMP Virtual Host (XML-RPC URL issue)?
-
Using MAMP 4.0.6, I have a virtual host set up on my Mac to run a local installation of WordPress 4.6.1. Before that, I installed the Jetpack plugin which wouldn’t allow me to connect to WordPress.com for all of the features because my local site didn’t have a dot in the URL.
I did the following to switch from localhost to a custom .dev URL for my local installation, referencing this site (https://foundationphp.com/tutorials/vhosts_mamp.php) and tweaking the tutorial code as follows:
In /etc/hosts:
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 127.0.0.1 mysite.dev 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
In MAMP’s httpd.conf, I uncommented the Virtual Hosts include as:
# Virtual hosts Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
In MAMP’s httpd-vhosts.conf I replaced the example vhosts as:
<VirtualHost *:80> DocumentRoot /Applications/MAMP/htdocs ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/myusername/Desktop/Work Folder/mysite.dev" ServerName mysite.dev <Directory /> Options Indexes FollowSymLinks AllowOverride All </Directory> </VirtualHost>
In order to avoid polluting any data sent to WordPress.com when/if I get Jetpack to work locally, I added the following to wp-config.php to define Staging Mode:
define( 'JETPACK_STAGING_MODE', true );
Also in wp-config.php, my database settings are as follows:
define('DB_NAME', 'mysite_wpdb'); define('DB_USER', 'root'); define('DB_PASSWORD', 'root'); define('DB_HOST', 'mysite.dev'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', '');
(Plus the required Unique Keys and Salts.)
I’ve managed to get rid of Jetpack’s development mode warning but when I click the “Connect Jetpack” button or the “No account? Create one for free…” link, the page refreshes with a red error box that reads:
> Error Details: The Jetpack server could not communicate with your site’s XML-RPC URL. Please check to make sure LINK/xmlrpc.php is working properly. It should show ‘XML-RPC server accepts POST requests only.’ on a line by itself when viewed in a browser and should not have any blank lines or extra output anywhere. Find out how to fix this issue here: https://jetpack.com/support/getting-started-with-jetpack/what-do-these-error-messages-mean/blank-lines-xmlrpc/
Thing is, when I go to my site’s xmlprc.php page, I get the proper ‘XML-RPC server accepts POST requests only.’ text without any extra spaces or characters. I can’t figure out what I need to change so that Jetpack will recognize my local staging WordPress site.
- The topic ‘How to connect Jetpack to a MAMP Virtual Host (XML-RPC URL issue)?’ is closed to new replies.