Using Nextcloud with Cloudflared

Hi,

I am installed Nextcloud over DietPiOS. I am also running some docker containers with Cloudflared tunnel and making them online. It seems Nextcloud uses subfolder connection instead of port (like /nextcloud) I was able to configure port connections with Cloudflared but Nextcloud uses subfolder instead of port url.

I am wondering, how can I open Nextcloud for internet access with a subdomain?

Thanks.

I assume you use the defualt webserver lighttpd, then you can check this out:
https://redmine.lighttpd.net/projects/1/wiki/docs_modrewrite#With-mod_redirect

There was also the same question in the past, it’s worth reading why it’s maybe not so a good idea / make thngs more complicated:
https://dietpi.com/forum/t/nextcloud-sub-domain/5219/3?u=jappe

1 Like

It uses the default HTTP/S ports 80/443 if that helps. AFAIK the subdir itself is not an issue for the Cloudflare tunnel.

1 Like

@Jappe in meantime, we changed this behaviour and lighttpd is not the default web server anymore. We added a selection screen to ask which web server to install :wink:

1 Like

And Apache is the default now for non-interactive installs on new images if it hasn’t been changed in dietpi.txt :slightly_smiling_face:.

1 Like

Thank you for all your replies.

I am using Nginx as the default web server. In the Cloudflared config.yml file, when i use the path URL like I got an error.

Cloudflared config.yml

- hostname: nextcloud.sitename.com
  service: http://localhost/nextcloud

cloudflared tunnel run tunnel-name

Output:

ERR Couldn't start tunnel error="http://localhost/nextcloud is an invalid address, ingress rules don't support proxying to a different path on the origin service. The path will be the same as the eyeball request's path"
http://localhost/nextcloud is an invalid address, ingress rules don't support proxying to a different path on the origin service. The path will be the same as the eyeball request's path

Did you tried to set http://localhost as service only?

2 Likes

Yes, that doesn’t work either.

Update: Yes, it works but with subdomain.site.com/nextcloud How can i access Nextcloud directly wtih subdomain.site.com?

This would require rewriting Nginx configuration files to create a VirtHost entry for Nextcloud running in webroot of nginx

1 Like