---
title: "Deploy Nextcloud"
description: "Deploy Nextcloud with Bucket storage for scalable cloud file hosting"
category: "Storage"
url: https://railway.com/deploy/nextcloud
---

# Deploy Nextcloud

Deploy Nextcloud with Bucket storage for scalable cloud file hosting

**[Deploy Nextcloud on Railway](https://railway.com/template/nextcloud)**

- **Creator:** decoge
- **Category:** Storage
- **Total deploys:** 107

## Template content

### Nextcloud

- **Image:** nextcloud
- **Start command:** `sh -lc 'set -e; P="${PORT:-8080}"; a2dismod mpm_event mpm_worker >/dev/null 2>&1 || true; a2enmod mpm_prefork >/dev/null 2>&1 || true; echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf; a2enconf servername >/dev/null 2>&1 || true; sed -i "s/^Listen 80$/Listen ${P}/" /etc/apache2/ports.conf; sed -i "s/<VirtualHost \*:80>/<VirtualHost *:${P}>/" /etc/apache2/sites-available/000-default.conf; exec /entrypoint.sh apache2-foreground'`
- **Public domain:** Yes

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

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

## Buckets

- **Storage**

## Documentation

# Deploy and Host Nextcloud on Railway

Nextcloud is a self-hosted, open-source cloud platform for file sync and sharing, calendars, contacts, and collaboration. It provides a private alternative to services like Google Drive or Dropbox, giving you full control over your data, users, and integrations while remaining extensible through a rich app ecosystem.

![](https://raw.githubusercontent.com/nextcloud/screenshots/master/nextcloud-hub-25-files.png)

## About Hosting Nextcloud

Hosting Nextcloud on Railway runs the official Nextcloud container as a managed web service, combined with a PostgreSQL database for application metadata and configuration. User files are stored using **Railway Storage Buckets**, which provide S3-compatible, durable object storage well suited for large file uploads and scalable cloud storage. Railway handles networking, secrets, volumes, and service restarts automatically, allowing you to deploy a production-ready Nextcloud instance without manual server management.

## Common Use Cases

* Private cloud file storage and sharing
* Photo backups and media libraries
* Team collaboration with calendars, contacts, and shared folders

## Dependencies for Nextcloud Hosting
### Environment Variables
Configure the following variables in the Railway dashboard:
* **NEXTCLOUD_ADMIN_USER:** Username for the initial Nextcloud admin account
* **NEXTCLOUD_ADMIN_PASSWOR:** Password for the initial Nextcloud admin account

### Deployment Dependencies

* Nextcloud Docker image: `nextcloud`
* Nextcloud documentation: [https://docs.nextcloud.com/](https://docs.nextcloud.com/)
* Railway PostgreSQL: [https://docs.railway.com/guides/postgresql](https://docs.railway.com/guides/postgresql)
* Railway Storage Buckets (S3-compatible object storage)
: [https://docs.railway.com/guides/storage-buckets](https://docs.railway.com/guides/storage-buckets)

## Why Deploy Nextcloud on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Nextcloud on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [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
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/nextcloud
