As I was writing about in the last post, there where some problems getting every thing to work with WP, Ubuntu and Nginx. One of the problems I got, was kind of a biggie.

TL;DR; Having problem with Nginx running WordPress and xmlrpc.php POST requests? Check that the fastcgi_params is included in your nginx.conf.

WordPress in it self is a very good and popular platform for publishing to the web. And the web interface has matured over the years, and are a real treat to use. However Automatic, the company behind WordPress.com, have also made a very good plugin for self hosted WordPress. The plugin Jetpack gives your WP install a lot more utilities and you as the user more functionality.

They have also made an excellent app for both iOS and Android, so you can post blog entries, photos and what not when you are away from a computer.

Both of these extras utilizes a file in your WP install called xmlrpc.php. This is the only file that should receive POST requests from the Internet. And this is needed for both the mobile app and Jetpack.

So, you should think that a vanilla install of Nginx on a basic Ubuntu box should kinda work almost out of the box. And, well, yes it does. Sort of. All GET requests works fine, and nice looking permalinks works fine after some tweaking.

But POST request made Nhinx say that POST is a no-no and a method that is not allowed. Or put in more techie way – a 405 error.

After using some time at google and tested out the beta version of Jetpack, I gave in and filed a bug report to Automattic. Less than 24 hours, I got a reply. And they had done their job testing against my (this) host. And from information I got from them and some google-fu – and quit a bit of testing and failing. I found the solution.

The standard vanilla install of Nginx, does not include a specific conf file. So if you have similar problems, check to see that your nginx.conf file has the line include  /etc/nginx/fastcgi_params;

So you should have a section of the nginx.conf file looking like this;

include /etc/nginx/fastcgi_params;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

So thanks Automattic and Nancy (with the amazing job title “Happiness Engineer”) for putting me on the right track!

[update]

Also make sure that only the stuff that should have access to xmlrpc.php has access to it. Add the following code to your .vhost file.

location = /xmlrpc.php {
if ($http_user_agent !~* "(poster|wordpress|windows live writer|wp-iphone|wp-android|wp-windowsphone)") {
return 403;
}

--
Rune