---
title: "Deploy Nextcloud 34 Files and Collaboration"
description: "Your own cloud for files, calendars and contacts, with Redis and cron."
category: "Storage"
url: https://railway.com/deploy/nextcloud-34-files-and-collaboration
---

# Deploy Nextcloud 34 Files and Collaboration

Your own cloud for files, calendars and contacts, with Redis and cron.

**[Deploy Nextcloud 34 Files and Collaboration on Railway](https://railway.com/template/nextcloud-34-files-and-collaboration)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/nextcloud-34-files-and-collaboration/manifest.json

- **Creator:** bento
- **Category:** Storage
- **Total deploys:** 1

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Nextcloud https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/nextcloud.svg

- **Source:** baranberkay96/nextcloud-railway
- **Health check:** /status.php
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Nextcloud with Railway

Nextcloud is an open-source cloud for files, calendars, contacts and collaboration that you run yourself. This community template deploys Nextcloud 34 on Railway with PostgreSQL, Redis for file locking and caching, background jobs on cron, and a choice between volume storage and a Railway Bucket for your files.

## About Hosting Nextcloud

Nextcloud is a PHP application served by Apache. It needs a database, Redis for transactional file locking and caching, a place to store files, and a cron job that runs background tasks every five minutes. On Railway a volume belongs to one service, so this template runs cron inside the Nextcloud container instead of a separate service. Nextcloud installs itself on first start with a generated admin password, installs the Calendar and Contacts apps, and trusts Railway's proxy so links use HTTPS and client IP addresses are correct. Files go to the service volume by default or, if you choose it before deploying, to a Railway Bucket.

## Common Use Cases

- Private Dropbox or Google Drive replacement for a family, club or small company.
- Calendar and contact sync for phones and desktops via CalDAV and CardDAV.
- Sharing files with clients through password-protected links.
- Team file server with desktop sync clients and mobile apps.

## Dependencies for Nextcloud Hosting

- Nextcloud server (official `nextcloud` Apache image)
- PostgreSQL 18
- Redis
- Storage: Railway volume (default) or Railway Bucket (S3)
- Optional: SMTP server for email notifications (Railway Pro plan)

### Deployment Dependencies

- Nextcloud admin manual: https://docs.nextcloud.com/server/latest/admin_manual/
- Official Docker image and its environment variables: https://github.com/nextcloud/docker
- Background jobs (cron): https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html
- S3 primary storage: https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html
- Railway Buckets: https://docs.railway.com/storage-buckets

### Implementation Details

| Service | Image | Role | Public |
|---|---|---|---|
| `Nextcloud` | `nextcloud:34.0.4-apache` + start script and hooks | Web UI, WebDAV/CalDAV/CardDAV, cron | HTTPS domain |
| `Postgres` | `ghcr.io/railwayapp-templates/postgres-ssl:18` | Database | — |
| `Redis` | `redis:8.2` | File locking, cache, sessions | — |
| `Bucket` | Railway Bucket | Optional primary storage | — |

**First login.** After the first deploy (about two minutes), open the domain and sign in as `admin` with the password in the `NEXTCLOUD_ADMIN_PASSWORD` variable. Change it, then create accounts for your users.

**Storage choice.** `NEXTCLOUD_PRIMARY_STORAGE=volume` (default) keeps files on the service volume, which is limited to 5 GB on the Hobby plan, including about 1 GB for Nextcloud itself. Set it to `bucket` before the first deploy to store files in the Railway Bucket without a size cap. The choice is locked after installation.

**Custom domain.** Add the domain to `NEXTCLOUD_TRUSTED_DOMAINS` (space-separated), set `OVERWRITECLIURL` to `https://{your-domain}` and redeploy.

**Email.** Nextcloud sends email over SMTP, which Railway allows on the Pro plan. Set `SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURE`, `SMTP_NAME`, `SMTP_PASSWORD`, `MAIL_FROM_ADDRESS` and `MAIL_DOMAIN`, or configure it under Administration → Basic settings.

**Scaling.** Nextcloud runs as one service with its volume. Give it more memory and raise `APACHE_MAX_REQUEST_WORKERS` (about 100 MB per worker) for more simultaneous users.

**Pinning and upgrades.** The version is the `FROM` line in `services/nextcloud/Dockerfile`. Upgrade one major version at a time (34 to 35, then 35 to 36); the container runs the upgrade on start.

### Why Deploy Nextcloud on Railway?

Railway runs Nextcloud, PostgreSQL and Redis together on a private network with automatic HTTPS, persistent storage and background jobs already configured. You keep your files and calendars on infrastructure you control and pay for the resources you use, with an optional Bucket for low-cost storage that grows with you.


## Similar templates

- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway

Open this page in a browser: https://railway.com/deploy/nextcloud-34-files-and-collaboration
