How do I set up FSyncMS on NGinx?

Mark Straver asked:

I’m trying to set up FSyncMS (a minimal php weave/sync1.1 server in php) on a server. I’ve gotten as far as setting up the back-end but I’m running into the problem that I can’t find a way to properly have nginx (my front-end web server) pass the requests to the php script.

The sync client passes parameters to the server with slash parameter URLs:


Which should be translated to:


And passed to the back-end as index.php with parameters everything after that.
Unfortunately nginx happily sees index.php/user/1.0/a as the path, instead of index.php as the path and /user/1.0/a as parameters. Result: a predictable 404…

More info on the sync server implementation (in German, unfortunately):

How do I get around this problem?

EDIT: nginx config:

server {
    listen 80;
    return 301 https://$server_name$request_uri;  # enforce https

server {
    listen 443 ssl;

    ssl_certificate /srv/syncserver/;
    ssl_certificate_key /srv/syncserver/;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers !aNULL:!LOW:!MD5:!EXP:CAMELLIA:AES256:HIGH:AES128:RC4:!3DES:!SEED;
    ssl_prefer_server_ciphers on;

    access_log /srv/www/sync/logs/access.log;
    error_log /srv/www/sync/logs/error.log;

    root /srv/www/sync/public_html;
    index index.php index.html;

    location / {
        ssi on;
        index index.php index.shtml index.html index.htm;

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

My answer:

You are missing your try_files to divert requests to PHP when no matching static assets are present.

For instance:

location / {
    try_files $uri $uri/ /index.php;

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.