Nginx Config

From DAViCal Wiki

Jump to: navigation, search

General Note

DAViCal is not a web application, in the sense of something like Drupal, Joomla, Flickr or Facebook. Rather, it is an HTTP application, needing full access to various header information passed to the webserver by the CalDAV client software.

Many web application stacks tend to assume that applications will only use GET and POST methods, for example, whereas DAViCal needs to receive the full request data for many other http methods including PUT, MOVE, PROPFIND, PROPPATCH, REPORT, MKCOL, MKCALENDAR and more.

As a result you may have increasing difficulty getting more obscure parts of DAViCal's functionality to work with FastCGI, such as creating calendars from within CalDAV client software.

Virtual Host Installation

You will need a running PHP FastCGI server on port 12345. This is not covered here, but since you are an nginx and PHP user, you most probably already know how to run it.

server {
       listen 80;
       server_name davical.example.net;

       access_log /var/log/nginx/davical.access_log main;
       error_log  /var/log/nginx/davical.error_log  warn;

       root    /usr/share/davical/htdocs;
       index   index.php index.html;

       keepalive_timeout 0;

       location /images/ {
       }

       location ~ \.php {
               include /etc/nginx/fastcgi_params;
               fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               fastcgi_pass    127.0.0.1:12345;
               fastcgi_index index.php;
       }
}

I had problems with the above config. This worked for me under nginx 0.7.61. -- blake

server {
       listen 80;
       server_name davical.example.net;

       access_log /var/log/nginx/davical.access_log;
       error_log  /var/log/nginx/davical.error_log;

       root    /usr/share/davical/htdocs;
       index   index.php index.html;

       keepalive_timeout 0;

       location /images/ {
       }

       location ~ ^(.+\.php)(.*)$ {
               include fastcgi_params;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_pass 127.0.0.1:12345;
                       
               fastcgi_split_path_info ^(.+\.php)(.*)$;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

               fastcgi_read_timeout 180;
               fastcgi_buffers 4 256k;
               fastcgi_buffer_size 128k;
               }

       location ~ \.php {
               include /etc/nginx/fastcgi_params;
               fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               fastcgi_pass    127.0.0.1:12345;
               fastcgi_index index.php;
       }
}
Personal tools