Apache Config
From DAViCal Wiki
|
Modules
The PHP5 module must be enabled.
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
Alias /images/ /usr/share/davical/htdocs/images/
<Directory /usr/share/davical/htdocs/>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
AcceptPathInfo On
php_value include_path /usr/share/awl/inc
php_value error_reporting "E_ALL & ~E_NOTICE"
php_value default_charset "utf-8"
php_admin_flag magic_quotes_gpc off
php_admin_flag register_globals off
# If the Suhosin extension is active
php_admin_flag suhosin.server.strip off
</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. Note that this is not as simple as 'open_basedir "1"' which you might see listed on some sites.)
- Optionally disable register_globals (recommended)
This can be done either in the php.ini file or in the Apache config file.
Listening on the Proper Port
As it is preferred to config DAViCal inside a VirtualHost, it is also recommended to make your DAViCal listen on a custom port. If you've set up DAViCal to run on port 8008 don't forget to edit Apache2's ports.conf file to listen on port 8008.
Listen 8008
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 existing file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# 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/
If you're using a virtual host, you'll need to use a recipe like this instead:
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's an existing file
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
# Everything else gets rewritten to /caldav.php/...
RewriteRule ^(.*)$ /caldav.php/$1 [NC,L]
because %{REQUEST_FILENAME} evaluates to %{REQUEST_URI} under a VirtualHost context.
If you've a virtual host, and DAViCal is not running in the root of that host but under a subdirectory such as /cal/, you'll need something like this. It's assumed the DAViCal installation is at /usr/share/davical (where Debian puts it):
# Rewrite /cal/USER/CALENDAR to /cal/caldav.php/USER/CALENDAR
# Exclude /cal/ itself
RewriteCond %{REQUEST_URI} !^/cal$
RewriteCond %{REQUEST_URI} !^/cal/$
# Exclude existing files such as admin.php and setup.php
RewriteCond /usr/share/davical/htdocs/$1 !-d
RewriteCond /usr/share/davical/htdocs/$1 !-f
# Everything else under /cal/ gets rewritten to /cal/caldav.php/...
# Note the PT flag, it make the Alias directory work
RewriteRule ^/cal/(.*)$ /cal/caldav.php/$1 [NC,PT]
Alias /cal/images/ /usr/share/davical/htdocs/images/
Alias /cal /usr/share/davical/htdocs
<Directory /usr/share/davical/htdocs/>
AllowOverride None
Order allow,deny
allow from all
AcceptPathInfo On
php_value include_path /usr/share/awl/inc
php_value error_reporting "E_ALL & ~E_NOTICE"
php_value default_charset "utf-8"
php_admin_flag magic_quotes_gpc off
php_admin_flag register_globals off
# If the Suhosin extension is active
php_admin_flag suhosin.server.strip off
</Directory>
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

