Skip to content

Set up Davdav on OS X Server

maasaamiichii edited this page Nov 16, 2012 · 24 revisions

#Configuration

In this manual, davdav install directory and webdav directory are the following.

Davdav Install directory: /Library/Server/Web/Data/WebApps

Webdav directory: /Users/username/Public/Webdav

#Set up Davdav

1.Download davdav

Download davdav from github and copy to

/Library/Server/Web/Data/WebApps

Do the step 1 and 4 of README.md.

2.Set up crontab

Set up crontab like the following:

sudo -H -u username crontab -e
*/5 * * * * python /Library/Server/Web/Data/WebApps/davdav/davdav/tool/cron.py

3.Edit davdav.ini

Edit davdav.ini like the following:

DEBUG=False
TESTING=False

DB_URI='mysql://user:password@localhost/davdav?charset=utf8'

WEBDAV_ROOT_URL='http://webdav.yourdomain.com/'
THUMB_ROOT_URL='http://davdav.yourdomain.com/thumbnail'

WEBDAV_DIR='/Users/username/Public/Webdav'
THUMB_DIR='/Library/Server/Web/Data/WebApps/davdav/thumbnail'

NUM_BY_PAGE=10

4.Set up OS X Server

Copy

/Library/Server/Web/Config/apache2/httpd_wsgi.conf

and paste and remane httpd_wsgi_davdav.conf in the same directory, and edit like the following:

WSGIScriptAlias / /Library/Server/Web/Data/WebApps/davdav/davdav/app/davdav.wsgi

And copy

/Library/Server/Web/Config/apache2/webapps/com.apple.webapp.wsgi.plist

and paste and rename com.davdav.plist in the same directory, and edit like the following:

<plist>
<dict>
        <key>name</key>
        <string>com.davdav</string>
        <key>displayName</key>
        <string>Davdav</string>
        <key>launchKeys</key>
        <array/>
        <key>proxies</key>
        <dict/>
        <key>installationIndicatorFilePath</key>
        <string>/Library/Server/Web/Data/WebApps/davdav/davdav/app/davdav.wsgi</string>
        <key>includeFiles</key>
        <array>
                <string>/Library/Server/Web/Config/apache2/httpd_wsgi_davdav.conf</string>
        </array>
        <key>requiredModuleNames</key>
        <array>
                <string>wsgi_module</string>
        </array>
</dict>
</plist>

Restart Server.app

Select Web Sites tab in OS X Server and add Web Sites like the following:

Domain Name: davdav.yourdomain.com
IP Address::Any  Port: 80
Store Site Files in: /Library/Server/Web/Data/WebApps/davdav/davdav/app

image1

Add Alias like the following:

/thumbnail /Library/Server/Web/Data/WebApps/davdav/thumbnail

Push Edit Adbanced Settings and check davdav in "Make these web apps available on this website:".

image2

And add WebSite like following:

Domain Name:webdav.yourdomain.com
IP Address:Any  Port: 80
Store Site Files in: /Users/username/Public/Webdav

Select File Sharing tab in OS X Server and add /Users/username/Public/Webdav to shared points.

Check "share with iOS devices (webdav)".

image3

Access to http://davdav.yourdomain.com from Web browser.

5.Bug fix

  • If you have an error "Internal Server error" and an error log like mod_wsgi target wsgi script cannot be loaded as Python modules.,

add

app_path = ‘/Library/Server/Web/Data/WebApps/davdav/davdav/app’
sys.path.append(app_path)

to davdav.wsgi.

  • If you can't make thumbnails, you may have to change the owner and permission of davdav.

sudo chown -R www:www /Library/Server/Web/Data/WebApps/davdav

sudo chmod -R 757 /Library/Server/Web/Data/WebApps/davdav