server {
   listen         80;
   server_name    mydomain.com;

   root           /var/www/mydomain.com;
   access_log     /var/log/nginx/mydomain.com.access.log;
   error_log      /var/log/nginx/mydomain.com.error.log;

   index          index.php index.html;
   charset        utf-8;
   log_not_found  off;

   location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
      expires max;
      add_header Pragma public;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate";
   }

   location = /favicon.ico  { access_log off; log_not_found off; }
   location = /robots.txt   { access_log off; log_not_found off; }
   location = /humans.txt   { access_log off; log_not_found off; }
   location ~ /\.ht   { access_log off; log_not_found off; deny all; return 404; }
   location ^~ /data  { access_log off; log_not_found off; deny all; return 404; }

   # rewrite for carddav autoprovision
   rewrite ^/.well-known/carddav /index.php/dav/ redirect;

   # php for carddav
   location ~ /index\.php/dav/.*$ {
      include fastcgi_params;

      fastcgi_pass   127.0.0.1:9000; # unix:/var/run/php5-fpm.sock;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

      fastcgi_split_path_info ^(.+\.php)(/[^?]*).*$;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_NAME      index.php;
      fastcgi_param  PATH_INFO        $fastcgi_path_info;
      fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
   }

   # php (other)
   location ~ \.php {
      include fastcgi_params;
      fastcgi_pass   127.0.0.1:9000; # unix:/var/run/php5-fpm.sock;
      fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
   }
}