Android Client and Sync with ownCloud on NGINX

I have been looking for a good way to move completely from Google for quite some time. Many of the things I am dependant upon them for are pretty vital for day to day operations. One of these is of course contact and calendar syncing. Currently, my solution to that problem is EGroupware for my server using syncml through Funambol to synchronize my contacts from my web server to my Android phone. This solution is bulky taking about 80 MB on my server for the PHP code. Though this works, it is hardly ideal. That's why I was so excited to try out ownCloud. Their Android client is still definitely a work in progress, but at least it's something (not to mention that they use standards-based services, so several other sync apps for Android can work with ownCloud).

Now, I run NGINX on my web server which does things a little differently than Apache, especially in regards to .htaccess files. Despite that though, out of the box (or tarball) ownCloud seems to work perfectly. However, when you try to sync up your Android phone via their dandy client, you get this obscure error Wrong path given Additionally, when you check your server access logs, you'll see Requested uri (/remote.php/webdav.php) is out of base uri (/remote.php/webdav/)

This is most likely because you need two location directives in your NGINX conf file (or vhost file if you're doing things that way). To fix this just put the following two things in your said config file (This assumes your own cloud server is running at http://example.com/owncloud ): location /owncloud { index index.php; try_files $uri $uri/ @owncloud } location @owncloud { rewrite ^/owncloud/(.*)$ /owncloud.php/index.php?p=$1 last; }

And that should do it for you!