Skip to content

Instantly share code, notes, and snippets.

@dstapp
Last active December 8, 2020 08:43
Show Gist options
  • Save dstapp/1aab06b82797acdaeab0 to your computer and use it in GitHub Desktop.
Save dstapp/1aab06b82797acdaeab0 to your computer and use it in GitHub Desktop.
Caddy ownCloud Gist
owncloud.dev.local:80 {
root /usr/local/www/owncloud/
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp /index.php/.*
to /index.php?{query}
}
log /usr/local/www/owncloud.log
# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/carddav 301
redir /.well-known/caldav /remote.php/caldav 301
# remove trailing / as it causes errors with php-fpm
rewrite {
r ^/remote.php/(webdav|caldav|carddav)(\/?)$
to /remote.php/{1}
}
rewrite {
r ^/remote.php/(webdav|caldav|carddav)/(.+)(\/?)$
to /remote.php/{1}/{2}
}
# this is still insanely insecure as all user files are located
# within the docroot and intended .htaccess restrictions are not interpreted
# Deny access copied from the nginx config at
# https://doc.owncloud.org/server/8.0/admin_manual/installation/nginx_configuration.html
rewrite {
r ^/(?:\.htaccess|data|config|db_structure\.xml|README)
status 403
}
}
@shyim
Copy link

shyim commented Mar 26, 2016

When i access with the config the webdav. i get everytime the message: 405 Method Not Allowed. I am currently using OwnCloud 9.
Have you any idea how to fix this?

@dstapp
Copy link
Author

dstapp commented Aug 6, 2016

@shyim sorry for the late reply. Are you using Caddy 0.8? There was no WebDAV support yet. In Caddy 0.9 it will work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment