Hardware

Self Hosted NextCloud Is Game Changing

Joshua Gao · 9 Dec 2024

Self Hosted NextCloud Is Game Changing

Have you run out of storage in your Google Drive? Do you not want to pay the pricy subscription fee just to save your photos? Try self hosting Nextcloud as your cloud storage solution!

I'll walk you through how a 1 liter PC can give you up to 8TB of cloud storage!

Raspberry Pi 5

raspberrypi 5

For most people, a small and inexpensive computer will suffice for reading and writing data from a storage device. I chose the $75 Raspberry Pi 5 with 8GB of RAM for self hosting. The Pi5 was perfect since it was the first Pi to support NVMe SSD's, which are much preferred over the bulky and noisy hard drives.

Unfortunately, the Pi5 doesn't support an NVMe connection out of the box, and requires some sort of Pi hat for this to work. That's where the Pironman 5 comes in.

Pironman 5 Case

pironman5

I'm going be honest, I could have just bought $8 basic NVMe hat instead of this $79 PC case, and everything would have worked fine. But despite all the good points .my girlfriend made about saving money, LOOK HOW COOL IT LOOKS 🤩. Between the finished aluminum case, the acrylic panels, LED lights, industrial looking heat sink, and the mini display, it was $79 dollars well spent.

Other than the price, the only real downside of the case is that it acts like a faraday cage with all the metal surrounding the wifi module on the Pi itself. I 100% recommend buying a USB wifi dongle, or ideally just have a wired LAN connection.

Nextcloud

Nextcloud is a free and open source self hosted platform that offers a suite of features such as file management, notes, password management, communication and more. However, I'm most interested in its file management system.

nextcloud files

My absolute favorite feature is the ability to sync your iPhone photos to Nextcloud just by downloading the mobile Nextcloud app. Now I don't even need to pay for iCloud storage that locks you in so easily.

nextcloud photos

Technical Setup Details

If you're trying to set this up yourself, this is the section for you.

There are better ways to set up Nextcloud, but I chose to:

  • Create a subdomain of this website
  • Containerize Nextcloud with Docker
  • Expose the Pi's ip with Ngrok

Setting Up a Subdomain

You don't have to set up a subdomain, you can just use any website url you own. I went with cloud.joshgao.com since I already own www.joshgao.com. If you don't have a domain, you can get one with any domain name provider like Squarespace or GoDaddy.

Note: If you only want to access Nextcloud through own network and not expose it to the internet, you don't have to get a domain.

Install and Containerize Docker

On your Pi, run the following to install Nextcloud and Docker:

sudo snap install nextcloud

sudo apt-install docker docker-compose

Then you need to edit the Nextcloud config:

# change the following path if need be

sudo nano ~/nextcloud/config/config.php

Then add 1 => your.domainnamehere.com to "trusted_domains". Change the url in "overwrite.cli.uri" to https://your.domainnamehere.com. Finally change "overwriteprotocol" to "https".

After you've configured Nextcloud, we need to setup the container with Docker. This container will spin up automatically on boot.

sudo docker run -d -p 8080:80 --name nextcloud --restart unless-stopped \

-v /home/tugonbob/nextcloud/nextcloud:/var/www/html \

-v /home/tugonbob/nextcloud/apps:/var/www/html/custom_apps \

-v /home/tugonbob/nextcloud/config:/var/www/html/config \

-v /home/tugonbob/nextcloud/data:/var/www/html/data \

-v /home/tugonbob/nextcloud/theme:/var/www/html/themes nextcloud

Expose Nextcloud to Internet

If you want to access your Nextcloud from anywhere, you need to expose it to the internet. I used Ngrok for this, but you can also use a reverse proxy like Nginx or Traefik.

Ngrok is $10 a month, which I know, totally defeats the purpose of this project. But it's still cheaper than cloud storage, and you can scale it to as many TB's as you want.

After you install Ngrok and follow their instructions to adjust your domain's DNS, simply run:

nohup ngrok http --domain=your.domainnamehere.com 8080 &

Cost

Here's a breakdown of the costs for this self-hosted cloud storage setup:

  • Raspberry Pi 5 (8GB RAM): $75

  • Pironman 5 Case: $79

  • NVMe SSD (1TB - 8TB): ~$50 - $400 (depending on capacity)

  • USB WiFi Dongle (optional): ~$10

  • Ngrok Subscription (optional, for remote access): $10/month

  • Domain Name (optional, for remote access): ~$10/year

Estimated one-time hardware cost: $214 - $564+ (depending on SSD size and optional accessories)

Estimated recurring cost: $10/month (Ngrok), $10/year (domain)

I chose a 2TB NVMe SSD, which cost me $120, which is a great balance between price and storage capacity.

This all does seem pricey for something that was meant to save money. I went for the cool factor which is absolutely not necessary. You can skip the Pironman 5 Case for a pi hat and a cheap RaspberryPi case, or even just skip the case all together. This would bring your cost down around ~$70.

You could also get an older Pi and just hook it up to a regular SSD with an adapter. Not only can you get Raspberry Pi 4 for just $35, but also non-NVMe SSDs are much cheaper than their NVMe counter parts.

Additionally, you can skip the Ngrok subscription if you figure out how to use Nginx. I never really figured out how it works, and Ngrok made it really easy and saved me a ton of time.

So the cheapest you could set up self hosted Nextcloud would be around just 50 bucks. Not bad at all.

Conclusion

Self-hosting your own cloud storage with Nextcloud is not only a fun and rewarding project—it also gives you full control over your data, removes reliance on big tech subscriptions, and can be surprisingly affordable if you go the budget route. Whether you're doing it for privacy, cost savings, or just the satisfaction of building your own infrastructure, setting up a Raspberry Pi-powered cloud server is a fantastic step toward digital independence. Happy hosting!