Want your own private cloud similar to Google Drive, OneDrive, or Dropbox? In this guide you'll learn how to deploy Nextcloud inside a Proxmox LXC container, store data on an external HDD, and expose it securely using Nginx Proxy Manager.
- ✅ Proxmox LXC Installation
- ✅ External HDD Storage Mount
- ✅ MariaDB Database Setup
- ✅ Nginx Proxy Manager Reverse Proxy
- ✅ Free SSL Certificates
- ✅ Domain Access from Anywhere
Requirements:
- Proxmox VE Installed
- Nginx Proxy Manager Running
- Domain or Dynamic DNS
- Mounted Storage Drive
🧠 What is Nextcloud?
Nextcloud is a self-hosted cloud platform that allows you to store files, sync devices, share documents, manage calendars, contacts, photos and much more.
- Private cloud storage
- File synchronization
- Mobile applications
- Document collaboration
- Photo backup
- WebDAV support
⚡ Step 1 — Create the Proxmox LXC
Create a Debian 12 LXC container with:
- 2 CPU Cores
- 2-4GB RAM
- 20GB+ Root Disk
- Privileged Container Recommended
📁 Step 2 — Mount External Storage
Edit the container configuration:
nano /etc/pve/lxc/<CTID>.conf
Add:
features: nesting=1,keyctl=1
mp0: /mnt/pve/<storage>/Containers/NextCloud,mp=/mnt/nextcloud-data
Restart the container:
pct restart <CTID>
🖥️ Step 3 — Install Required Packages
apt update && apt upgrade -y
apt install apache2 mariadb-server \
libapache2-mod-php \
php php-gd php-json php-mysql \
php-curl php-mbstring php-intl \
php-imagick php-xml php-zip \
php-bcmath php-gmp unzip wget -y
🗄️ Step 4 — Create Database
mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'ncuser'@'localhost'
IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON nextcloud.*
TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
⬇️ Step 5 — Download Nextcloud
cd /var/www
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
chown -R www-data:www-data /var/www/nextcloud
📂 Step 6 — Configure Data Directory
mkdir -p /mnt/nextcloud-data/data
chown -R www-data:www-data /mnt/nextcloud-data
chmod -R 775 /mnt/nextcloud-data
If you're using an unprivileged container, UID mapping issues may prevent Nextcloud from writing to the mounted directory. A privileged container avoids this complexity.
🌐 Step 7 — Configure Apache
nano /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
ServerName cloud.example.com
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Enable configuration:
a2ensite nextcloud.conf
a2enmod rewrite headers env dir mime
systemctl restart apache2
🚀 Step 8 — Complete Web Installer
Open:http://<server-ip>
Fill in:
- Admin Username
- Admin Password
- Data Folder: /mnt/nextcloud-data/data
- Database User: ncuser
- Database Name: nextcloud
- Database Host: localhost
🔒 Step 9 — Configure Reverse Proxy
Edit:nano /var/www/nextcloud/config/config.php
Add:
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'cloud.example.com',
),
'trusted_proxies' => ['<proxy-ip>'],
'overwrite.cli.url' =>
'https://cloud.example.com',
'overwriteprotocol' => 'https',
🌍 Step 10 — Configure Nginx Proxy Manager
Create a new Proxy Host:- Domain: cloud.example.com
- Forward Host: <local-ip>
- Forward Port: 80
- WebSockets Support
- Block Common Exploits
- Force SSL
- HTTP/2
client_max_body_size 10G;
📤 Step 11 — Increase Upload Limits
Edit:nano /etc/php/*/apache2/php.ini
Set:
upload_max_filesize = 10G
post_max_size = 10G
memory_limit = 512M
Restart:
systemctl restart apache2
🎉 Final Result
You now have a fully self-hosted cloud solution running on Proxmox with persistent HDD storage, HTTPS access, and secure remote access through Nginx Proxy Manager.
Possible Next Steps:
- Enable Redis Caching
- Configure Automated Backups
- Install Nextcloud Office
- Add Mobile Auto-Upload
- Enable Two-Factor Authentication
- Integrate External Storage
☁️ Your Private Cloud • Your Data • Your Control
Comments
Post a Comment