Apache Config

From DAViCal Wiki

Jump to: navigation, search

Contents

Virtual Host Installation

For basic virtual host installation see the DAViCal Installation page. This is the recommended way of installing DAViCal since it ensures that the PHP settings for DAViCal are not in conflict with the settings for other applications hosted by the same Apache server.

<VirtualHost 123.4.56.78 > 
  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  ServerName davical.example.net
  ServerAlias calendar.example.net
  <Directory /usr/share/davical/htdocs/>
     AllowOverride None
     Order allow,deny
     Allow from all
  </Directory>
  Alias /images/ /usr/share/davical/htdocs/images/
  php_value include_path /usr/share/awl/inc
  php_value magic_quotes_gpc 0
  php_value register_globals 0
  php_value open_basedir 1
</VirtualHost>

Installation in a Sub Directory

To install in a subdirectory you should not need anything special, except that the path to /caldav.php and so forth will be further down the path. Where you want to make DAViCal available, symlink to the 'htdocs' directory as (e.g.) davical.

Alternatively, if you have root access, you should be able to do something like:

Alias /cal/ /usr/share/davical/htdocs

You will also need to set some PHP settings:

  • Append /usr/share/awl/inc to the include_path
  • Disable magic_quotes_gpc
  • Enable open_basedir (enabled by default, but might be disabled in some circumstances)
  • Optionally disable register_globals (recommended)

This can be done either in the php.ini file or in the Apache config file.

Fancy Stuff

URL Rewriting

If you want to get rid of the "/caldav.php" in the URL this can be done with Apache's URL rewriting (mod_rewrite) as follows:

RewriteEngine On

# Not if it's the root URL.  You might want to comment this out if you
# want to use an explicit /index.php for getting to the admin pages.
RewriteCond %{REQUEST_URI} !^/$

# Not if it explicitly specifies a .php program, stylesheet or image
RewriteCond %{REQUEST_URI} !\.(php|css|js|png|gif|jpg)

# Everything else gets rewritten to /caldav.php/...
RewriteRule ^(.*)$ /caldav.php$1  [NC,L]

This means that a URL like this would now work for user2's 'lectures' calendar, for example:

http://calendar.example.net/user2/lectures/

ProxyPass

If you want to use ProxyPass for redirecting a location from an apache (for example http://www.yoursite.com/calendars) to another apache with Davical installed, you had to create two ProxyPass rules on the www.yoursite.com virtual host:

ProxyPass /calendars http://davical.yourlan.local/calendars/
ProxyPassReverse /calendars http://davical.yourlan.local/calendars/

and then modify the virtualhost configuration of the davical apache by adding an alias named /calendars pointing to the document root:

  Alias /calendars /usr/share/davical/htdocs

everything should work.

Distinct Logs

You might wish to add the following:

ErrorLog     /var/log/httpd/davical.error_log
TransferLog  /var/log/httpd/davical.access_log

See Also

  • FastCGI for special considerations for running DAViCal with FastCGI
  • FCGI ditto for fcgid
Personal tools