What is Nextcloud?
Nextcloud is a self-hosted alternative to Google Drive, Dropbox, and Microsoft 365. It provides file sync, calendar, contacts, mail, video calls, and hundreds of apps.
Requirements
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 512 MB | 2+ GB |
| Storage | 10 GB | Based on usage |
| PHP | 8.1+ | 8.3 |
| Database | SQLite | MariaDB 10.6+ |
| Web Server | Apache or Nginx | Nginx |
Docker Installation (Recommended)
# docker-compose.yml
services:
nextcloud:
image: nextcloud:28-apache
ports:
- "8080:80"
volumes:
- nextcloud_data:/var/www/html
environment:
- MYSQL_HOST=db
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=secure-password-here
depends_on:
- db
restart: unless-stopped
db:
image: mariadb:11
volumes:
- db_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root-password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=secure-password-here
restart: unless-stopped
volumes:
nextcloud_data:
db_data:
docker compose up -d
Nginx Reverse Proxy
server {
listen 443 ssl http2;
server_name cloud.example.com;
ssl_certificate /etc/letsencrypt/live/cloud.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cloud.example.com/privkey.pem;
client_max_body_size 10G;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Performance Tuning
Enable Redis Caching
# Add to docker-compose.yml
redis:
image: redis:7-alpine
restart: unless-stopped
Add to config.php:
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'redis',
'port' => 6379,
],
PHP Tuning
memory_limit = 512M
upload_max_filesize = 10G
post_max_size = 10G
max_execution_time = 3600
Essential Post-Install Steps
- Set up trusted domains in
config.php - Configure email server for notifications
- Enable 2FA for all users
- Set up background jobs via cron (not AJAX)
- Install and configure the Collabora or OnlyOffice app for document editing
Warning Always set
client_max_body_sizein Nginx to match your upload limit. The default 1M will prevent any meaningful file uploads.