Nextcloud snap ubuntu 22.04 with VPN tunnel

Hi, I installed the nextcloud snap on ubuntu 22.04, this will be a home server for 4 people. and I am on a t-mobile home internet account behind cgnat :frowning: . I login and setup a admin account with the web interface and I can access it on my local network @ I signed up for and installed Private Internet Access and login and test tun0 with ncat I see traffic when I test from my phone off my network. When I try to connect I get server Busy or server reset. How do I setup access to my nextcloud from this tunnel.
Thanks In Advance.


There are two ways to make your server exposed to the Internet and access from out side network via Internet.

  1. Using a VPS and then traffic forwarding via VPN Tunnel
  2. Using a solution like CloudFlare Tunnel

Both of these are technically free (code is free) but both requires money for logistical setup. For example,

  1. In case of option 1, you may need to spend monthly fee for a Cloud VPS for Static IP and enough bandwidth.
  2. CloudFlare needs a fully functional TLD or ccTLD. Domain registration costs your money on per year basis.

Now there are few services you can explore to make option 1 completely free. That is like using Amazon (AWS) or Oracle Cloud Services (OCI) and take advantage of their always free tier basic VPS to route the connection.

It is little complicated requires you to spend some time with setup and various commands

In comparison, cloudflare solution is really simple, and one command job to setup but you need a domain name. Any TLD or ccTLD will do. Search in Google, you can find odd extensions like .pw or .online at USD 1.5 for the entire year.

How to add CloudFlare Tunnel in your Snap Setup?

Step 1 → Buy a Domain

Step 2 → Sign up for CloudFlare Free A/C

Step 3 → Add domain in CloudFlare Dashboard. It will generate NS (name server) values

Step 4 → Go back to your domain registration website and their their control panel for your domain DNS, add those values as given by cloudflare.

(Usually takes around 30 mins but it may take longer some times, like upto a full day). Once the DNS updates are done, cloudflare account will show your domain as active.

Step 5 → While you wait for cloudflare to update, change the ports of nextcloud snap in your local server. sudo snap set nextcloud ports.http=880 ports.https=1444. Secondly, activate and install a self sign certificate (for some reason, nextcloud smartphone app wont work without with). sudo nextcloud.enable-https self-signed

Step 6 → Go back to CloudFlare panel, and if the domain is shown active proceed to the “Zero Trust” page (LHS navigation panel. There on that new page, use the LHS navigation for “Access” then “Tunnels”. There create a tunnel and copy the installation code for Debian and run that with sudo access in your local Ubuntu server with snap.

Step 7 → There at that page, after running the tunnel installation code, click next to proceed for creating a public “Host Name”.

Subdomain :- nextcloud (or anything your prefer)
Domain :- Select your own domain from the drop down menu.
Path :- Leave it blank
Type :- HTTPS
URL :- localhost:1444

Now under “Application Additional Settings”, go to TLS option, and there turn on “No TLS Verify” and “HTTP2 Connection”.


Click “Save Hostname”.

Access Nextcloud

Under local network, your server is accessible via https://Local.IP:1444 for external access, https://nextcloud.yourdomain.whatever


I have a tunnel and tested it with ncat. they give me a port I can forward I don’t get to select this port and traffic from my IP they give me goes to port 50534 on my computer. I run ncat with port 50534 and check from my phone and I can see traffic. how do I point that port from the tunnel to my nextcloud snap?

Thank you.


I am not sure but I think you may need two ports atleast for SSL to work. So without SSL you can manage with single port.

You need to test it out.

Now for mapping that port, you can use following commands to change snap nextcloud port

sudo snap set nextcloud ports.http=50534 → In case your install is without SSL


sudo snap set nextcloud ports.https=50534 → In case your install is with SSL

Now run that tunnel in to your Ubuntu box. Your nextcloud installation should now be available via http:// or https:// Your.Tunnel.External.IP:50534