Running Nextcloud on Proxmox VE
Step-by-step guide to deploying Nextcloud on Proxmox VE using an LXC container with MariaDB, PHP-FPM, Nginx reverse proxy, SSL certificates, trusted domains, and external storage integration.
Self-Hosted Cloud Storage with Nextcloud
Nextcloud is the leading open-source alternative to Google Drive and Dropbox. It gives you file sync, calendar, contacts, video calls, and a growing library of apps — all under your control. Running Nextcloud on Proxmox VE in an LXC container is the most efficient deployment method, combining low overhead with strong isolation and easy backups.
Creating the LXC Container
Nextcloud benefits from fast storage for its database and file operations. Place the container rootfs on SSD or NVMe storage, and use a separate mount for bulk file data if needed:
# Create the container
pct create 130 local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst \
--hostname nextcloud \
--memory 2048 \
--cores 2 \
--rootfs local-lvm:20 \
--net0 name=eth0,bridge=vmbr0,ip=192.168.1.30/24,gw=192.168.1.1 \
--unprivileged 1 \
--features nesting=1 \
--start 1
Installing the LEMP Stack
Nextcloud runs on PHP and requires a database backend. MariaDB and PHP-FPM with Nginx provide the best performance:
# Install required packages
apt update && apt upgrade -y
apt install -y nginx mariadb-server \
php8.2-fpm php8.2-gd php8.2-mysql php8.2-curl \
php8.2-mbstring php8.2-intl php8.2-gmp php8.2-bcmath \
php8.2-xml php8.2-zip php8.2-imagick php8.2-apcu \
php8.2-redis redis-server unzip wget sudo
Configuring MariaDB
Create a dedicated database and user for Nextcloud:
# Secure the installation
mysql_secure_installation
# Create database and user
mysql -u root -p <<EOF
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'YourSecurePassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EOF
PHP-FPM Tuning
Edit the PHP-FPM pool configuration to optimize for Nextcloud's workload:
# /etc/php/8.2/fpm/pool.d/www.conf
[www]
user = www-data
group = www-data
listen = /run/php/php8.2-fpm.sock
pm = dynamic
pm.max_children = 16
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8
# PHP settings for Nextcloud
php_value[upload_max_filesize] = 16G
php_value[post_max_size] = 16G
php_value[memory_limit] = 512M
php_value[max_execution_time] = 3600
php_value[max_input_time] = 3600
# /etc/php/8.2/fpm/conf.d/99-nextcloud.ini
opcache.enable=1
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
Downloading and Installing Nextcloud
# Download latest Nextcloud
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
mv nextcloud /var/www/nextcloud
chown -R www-data:www-data /var/www/nextcloud
Nginx Configuration
Configure Nginx as the web server with proper headers and rewrite rules:
# /etc/nginx/sites-available/nextcloud
upstream php-handler {
server unix:/run/php/php8.2-fpm.sock;
}
server {
listen 80;
server_name cloud.example.com;
root /var/www/nextcloud;
index index.php index.html;
client_max_body_size 16G;
client_body_timeout 3600s;
fastcgi_buffers 64 4K;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header Referrer-Policy "no-referrer";
location = /robots.txt { allow all; log_not_found off; access_log off; }
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; }
location ~ \.php(?:$|\/) {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
expires 6M;
access_log off;
}
}
# Enable the site
ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
nginx -t && systemctl reload nginx
SSL with Let's Encrypt
If your Nextcloud instance is publicly accessible, add SSL using Certbot:
apt install -y certbot python3-certbot-nginx
certbot --nginx -d cloud.example.com --agree-tos -m admin@example.com
Trusted Domains and Final Setup
After completing the web-based installer, edit the Nextcloud config to add your trusted domains and enable caching:
# /var/www/nextcloud/config/config.php — add these entries
'trusted_domains' =>
array (
0 => '192.168.1.30',
1 => 'cloud.example.com',
),
'default_phone_region' => 'US',
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),
'overwriteprotocol' => 'https',
External Storage Integration
Nextcloud can mount external storage — NFS, SMB, S3 — as folders visible to users. This is ideal when your media or archive data lives on a NAS:
# Install SMB client in the container
apt install -y smbclient libsmbclient-dev
# Enable the External Storage app in Nextcloud
sudo -u www-data php /var/www/nextcloud/occ app:enable files_external
# Mount an NFS share on the host and bind-mount into the container
# In /etc/pve/lxc/130.conf:
mp0: /mnt/nas-data,mp=/mnt/external-data
Then configure the external storage mount in Nextcloud's admin panel under Settings > External Storage, pointing to /mnt/external-data.
Maintenance and Monitoring
Set up a cron job for Nextcloud background tasks, which is more reliable than the default AJAX method:
# Run Nextcloud cron every 5 minutes
crontab -u www-data -e
*/5 * * * * php -f /var/www/nextcloud/cron.php
Backing up the container with Proxmox's built-in tools captures both the Nextcloud application and its database in a single consistent snapshot. For quick status checks — especially after updates or reboots — ProxmoxR lets you confirm your Nextcloud container is running from your phone without logging into the Proxmox web interface.
Conclusion
Nextcloud on Proxmox gives you a private cloud platform that rivals commercial services. An LXC container keeps resource usage minimal, MariaDB with Redis provides snappy performance, and Proxmox snapshots make upgrades risk-free. Once set up, you have full control over your files, calendar, and contacts — no subscription fees, no data mining, no limits.
Take Proxmox management mobile
All the features discussed in this guide — accessible from your phone with ProxmoxR. Real-time monitoring, power control, firewall management, and more.