NewCode CLOUD — 20% off your first month on all cloud VPSClaim

How to Set Up Nextcloud on Hong Kong VPS: Self-Hosted Google Drive for Asia (2026)

· 5 min read

Nextcloud is the leading open-source file sync and collaboration platform — a self-hosted alternative to Google Drive, Dropbox, and SharePoint that keeps all files on infrastructure you control. Deployed on a Hong Kong VPS, it gives Asia-Pacific teams fast file sync regardless of Google Drive’s accessibility in mainland China, while keeping documents and sensitive files off third-party cloud servers.


Why Nextcloud on Hong Kong VPS for Asia Teams

  • Google Drive inaccessibility in China — Google services are blocked in mainland China; a self-hosted Nextcloud in Hong Kong with CN2 GIA routing is accessible to mainland Chinese team members
  • Data sovereignty — files remain on your VPS, not on Google’s or Dropbox’s US servers
  • No storage limits — your storage is limited only by your VPS disk; no per-GB pricing or storage tier upgrades
  • Office document collaboration — Nextcloud with Collabora Online or OnlyOffice enables real-time collaborative document editing, similar to Google Docs
  • Cost — Google Workspace Business Standard costs $12/user/month; Nextcloud on a VPS you already have is effectively free

VPS Requirements

Team Size RAM vCPU Storage
1–10 users 2 GB 2 100 GB+ NVMe
10–50 users 4 GB 4 500 GB+ NVMe
50–100 users 8 GB 8 1 TB+ NVMe

Storage is the primary constraint for Nextcloud — provision based on expected file volume, not team size. A 10-person team with large video and design file workflows needs more storage than a 50-person team that primarily syncs documents.


Step 1: Install Dependencies

apt update && apt upgrade -y
apt install -y nginx mysql-server php8.2-fpm php8.2-mysql php8.2-xml \
  php8.2-mbstring php8.2-curl php8.2-zip php8.2-gd php8.2-intl \
  php8.2-bcmath php8.2-gmp php8.2-imagick php8.2-redis \
  redis-server unzip wget

Configure PHP for Nextcloud

nano /etc/php/8.2/fpm/php.ini
memory_limit = 512M
upload_max_filesize = 16G
post_max_size = 16G
max_execution_time = 3600
date.timezone = Asia/Hong_Kong
output_buffering = Off
nano /etc/php/8.2/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10
systemctl restart php8.2-fpm

Step 2: Configure MySQL

mysql -u root -p << 'SQL'
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
SQL

Step 3: Download and Install Nextcloud

cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
cp -r nextcloud /var/www/nextcloud
chown -R www-data:www-data /var/www/nextcloud
mkdir -p /var/nextcloud-data
chown -R www-data:www-data /var/nextcloud-data

Step 4: Configure Nginx

cat > /etc/nginx/sites-available/nextcloud << 'EOF'
upstream php-handler {
    server unix:/var/run/php/php8.2-fpm.sock;
}

server {
    listen 443 ssl http2;
    server_name cloud.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/cloud.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cloud.yourdomain.com/privkey.pem;

    root /var/www/nextcloud;
    index index.php index.html;

    client_max_body_size 16G;
    fastcgi_buffers 64 4K;

    add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
    add_header Referrer-Policy "no-referrer" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Download-Options "noopen" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "noindex, nofollow" always;
    add_header X-XSS-Protection "1; mode=block" always;

    location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; }
    location = /.well-known/caldav  { return 301 $scheme://$host/remote.php/dav; }

    location / {
        rewrite ^ /index.php;
    }

    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; }
    location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console)          { deny all; }

    location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;
        fastcgi_pass php-handler;
        fastcgi_read_timeout 3600;
        fastcgi_request_buffering off;
    }

    location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
        try_files $uri /index.php$request_uri;
        expires 6M;
        access_log off;
    }

    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
        try_files $uri /index.php$request_uri;
        access_log off;
    }
}
EOF

ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
certbot --nginx -d cloud.yourdomain.com
nginx -t && systemctl reload nginx

Step 5: Complete Web Installation

Visit https://cloud.yourdomain.com and complete the setup wizard:

  • Admin account: choose a strong username and password
  • Data folder: /var/nextcloud-data
  • Database: MySQL — host localhost, database nextcloud, user nextcloud, password as set above

After installation completes, apply recommended configuration:

# As the web server user
sudo -u www-data php /var/www/nextcloud/occ maintenance:install \
  --database mysql \
  --database-host localhost \
  --database-name nextcloud \
  --database-user nextcloud \
  --database-pass StrongPassword123! \
  --admin-user admin \
  --admin-pass AdminPassword! \
  --data-dir /var/nextcloud-data

Step 6: Configure Redis for Caching

sudo -u www-data php /var/www/nextcloud/occ config:system:set \
  memcache.local --value='\OC\Memcache\Redis'

sudo -u www-data php /var/www/nextcloud/occ config:system:set \
  memcache.locking --value='\OC\Memcache\Redis'

sudo -u www-data php /var/www/nextcloud/occ config:system:set \
  redis host --value='127.0.0.1'

sudo -u www-data php /var/www/nextcloud/occ config:system:set \
  redis port --value='6379' --type=integer

Step 7: Set Up Background Jobs

# Add to crontab for www-data user
crontab -u www-data -e

# Add:
*/5 * * * * php -f /var/www/nextcloud/cron.php

# In Nextcloud admin settings → Basic settings → Background jobs → select "Cron"

Step 8: Install Collabora Online for Document Editing

# Install Collabora Online (CODE — Collabora Online Development Edition) via Docker
docker run -d \
  --name collabora \
  -p 127.0.0.1:9980:9980 \
  -e "aliasgroup1=https://cloud\.yourdomain\.com:443" \
  -e "username=admin" \
  -e "password=AdminPassword" \
  --restart always \
  collabora/code

In Nextcloud admin panel: install the Nextcloud Office app, then configure it to point to https://cloud.yourdomain.com:9980 (expose Collabora via Nginx with SSL). Team members can now edit .docx, .xlsx, and .pptx files collaboratively in the browser.


Desktop and Mobile Sync Clients

Install official Nextcloud clients to sync files to devices:

  • Desktop: Download from nextcloud.com/install — Windows, macOS, Linux
  • iOS: Nextcloud app from the App Store
  • Android: Nextcloud app from Google Play or F-Droid

Configure each client with server URL https://cloud.yourdomain.com and your user credentials. Files sync automatically whenever changes are detected.


Automated Backups

cat > /opt/nextcloud-backup.sh << 'EOF' #!/bin/bash DATE=$(date +%Y%m%d_%H%M%S) BACKUP_DIR="/opt/backups/nextcloud" mkdir -p $BACKUP_DIR # Enable maintenance mode sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on # Backup database mysqldump -u nextcloud -pStrongPassword123! nextcloud | \ gzip > $BACKUP_DIR/nextcloud_db_$DATE.sql.gz

# Backup data directory (user files)
rsync -az /var/nextcloud-data/ $BACKUP_DIR/data_$DATE/

# Backup Nextcloud config
cp /var/www/nextcloud/config/config.php $BACKUP_DIR/config_$DATE.php

# Disable maintenance mode
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off

# Keep 7 days
find $BACKUP_DIR -name "*.sql.gz" -mtime +7 -delete
find $BACKUP_DIR -name "config_*" -mtime +7 -delete
echo "Nextcloud backup complete: $DATE"
EOF
chmod +x /opt/nextcloud-backup.sh
crontab -l | { cat; echo "0 3 * * * /opt/nextcloud-backup.sh"; } | crontab -

Conclusion

Self-hosting Nextcloud on a Hong Kong VPS solves the key productivity challenge for Asia-Pacific teams: providing Google Drive-equivalent file sync and collaboration to mainland Chinese team members who cannot access Google services. CN2 GIA routing delivers fast sync speeds from China, data stays on your infrastructure, and the Collabora Online integration adds real-time document collaboration without any per-user SaaS fees.

Launch your private cloud: Browse Server.HK Hong Kong VPS plans — a 4 GB plan with additional storage volume handles Nextcloud for most teams up to 50 users.

Related articles

More in VPS & ServersServer setup guides