Technitium DNS server zone high-availability

Caddy Reverse Proxy with NextCloud using custom or sub-directory URL

Caddy reverse proxy with NextCloud using custom or sub-directory URL.

1. Setup caddy reverse proxy configuration with custom URL or location.

# Replace the FQDN with your own
your.server.com:80 {
    # Enable caddy logging
    #log {
    #    output file /var/log/caddy/your.server.com.access.log {
    #        roll_size 10mb
    #        roll_keep 20
    #        roll_keep_for 720h
    #    }
    #}

    route /nextcloud* {
        uri strip_prefix /nextcloud
        reverse_proxy http://your_nextcloud_IP
    }
    
    # Nextcloud CalDAV or CardDAV setup
    # fix or suppress unknown webfinger and nodeinfo error
    # https://github.com/nextcloud/documentation/issues/6157
    redir /.well-known/carddav /remote.php/dav 301
    redir /.well-known/caldav /remote.php/dav 301
    redir /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger 301
    redir /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo 301
}

2. Apply the same custom URL or location to NextCloud configuration too.

sudo -u www-data php /var/www/nextcloud/occ config:system:set overwritewebroot --value="/nextcloud"

Comments