Panduan Install Nextcloud Terbaru di Debian (Nginx + PHP-FPM + MariaDB)
- Rabu, 25 November 2026
- Kanghaki
- 0 komentar
Ringkasan
Versi terbaru adalah Nextcloud 35.0.3 (Hub 26 Summer, dirilis 12 November 2026), dan versi ini butuh PHP 8.3 atau lebih baru. Karena itu server harus naik ke Debian 13 (Trixie), bukan cukup Debian 12.
|
Versi Debian |
PHP bawaan |
Bisa Nextcloud 35? |
|---|---|---|
|
Debian 11 (Bullseye) |
7.4 |
Tidak. Repo sury untuk bullseye juga sudah 404 |
|
Debian 12 (Bookworm) |
8.2 |
Tidak. PHP 8.2 dihapus di Nextcloud 35 (maksimal Nextcloud 34) |
|
Debian 13 (Trixie) |
8.4 |
Ya, dan ini satu-satunya Debian yang didukung resmi |
Jalur yang dipakai panduan ini: Debian 11 → 12 → 13 (tidak bisa loncat langsung), lalu Nginx + PHP 8.4-FPM + MariaDB 11.8 dari repo bawaan Debian 13. Tidak perlu repo sury lagi.
Catatan penting:
- Semua perintah dijalankan sebagai root (atau pakai
sudo). - Ganti
cloud.domainanda.comdengan domain atau IP server Anda. - Kalau server masih kosong dan tidak ada data penting, install ulang langsung Debian 13 sering lebih cepat dan lebih bersih daripada upgrade dua kali. Kalau memilih ini, lewati Langkah 1.
Langkah 1: Upgrade Debian 11 ke 12 lalu ke 13
Upgrade dilakukan dua tahap, masing-masing diakhiri reboot. Backup dulu data penting (atau snapshot VPS) sebelum mulai.
1a. Bersihkan sisa repo sury dan PHP lama. Repo sury yang 404 akan membuat apt gagal, dan PHP 8.4 dari sury bisa bentrok dengan paket Debian.
# lihat file repo tambahan
ls /etc/apt/sources.list.d/
# hapus repo sury (nama file bisa berbeda, sesuaikan)
rm -f /etc/apt/sources.list.d/php.list /etc/apt/sources.list.d/*sury*
rm -f /usr/share/keyrings/deb.sury.org-php.gpg /etc/apt/trusted.gpg.d/php.gpg
# hapus semua paket PHP yang sudah terpasang
apt purge -y 'php*'
apt autoremove -y
1b. Debian 11 ke Debian 12 (Bookworm).
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
# tambahkan komponen firmware baru Debian 12
sed -i 's/non-free$/non-free non-free-firmware/' /etc/apt/sources.list
apt update
apt upgrade --without-new-pkgs -y
apt full-upgrade -y
reboot
Setelah reboot, pastikan sudah Debian 12:
cat /etc/debian_version # harus 12.x
1c. Debian 12 ke Debian 13 (Trixie).
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
apt update
apt upgrade --without-new-pkgs -y
apt full-upgrade -y
apt autoremove -y
reboot
Cek lagi dengan cat /etc/debian_version (harus 13.x). Kalau sources.list Anda kosong dan repo ada di /etc/apt/sources.list.d/debian.sources, jalankan perintah sed yang sama pada file itu.
Isi /etc/apt/sources.list yang benar untuk Debian 13 kurang lebih seperti ini:
deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
Langkah 2: Install Nginx, PHP 8.4-FPM, dan ekstensi
apt update
apt install -y nginx unzip wget curl redis-server \
php-fpm php-cli php-mysql php-gd php-curl php-mbstring php-intl \
php-gmp php-bcmath php-xml php-zip php-imagick php-apcu php-redis
# opsional: dukungan preview SVG (lewati kalau paket tidak ditemukan)
apt install -y libmagickcore-7.q16-10-extra
php -v # harus PHP 8.4.x
systemctl status php8.4-fpm # harus active (running)
Pastikan Apache benar-benar tidak ada, supaya port 80 tidak direbut:
systemctl disable --now apache2 2>/dev/null; apt purge -y 'apache2*'
Atur php.ini untuk FPM di /etc/php/8.4/fpm/php.ini. Cari dan ubah baris berikut (pakai nano, tekan Ctrl+W untuk mencari):
memory_limit = 512M
upload_max_filesize = 2G
post_max_size = 2G
max_execution_time = 3600
max_input_time = 3600
date.timezone = Asia/Jakarta
opcache.enable = 1
opcache.interned_strings_buffer = 32
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 256
opcache.save_comments = 1
opcache.revalidate_freq = 60
Atur pool FPM di /etc/php/8.4/fpm/pool.d/www.conf. Pastikan baris ini aktif (hapus tanda ; di depannya):
user = www-data
group = www-data
clear_env = no
env[PATH] = /usr/local/bin:/usr/bin:/bin
pm = dynamic
pm.max_children = 32
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8
Aktifkan APCu untuk perintah occ di CLI, lalu restart:
echo 'apc.enable_cli=1' >> /etc/php/8.4/mods-available/apcu.ini
systemctl restart php8.4-fpm
Langkah 3: Install MariaDB dan buat database
apt install -y mariadb-server
systemctl enable --now mariadb
mariadb-secure-installation
Saat mariadb-secure-installation, jawab: Enter (password root kosong), lalu n untuk unix_socket, Y untuk menghapus user anonim, melarang login root jarak jauh, menghapus database test, dan reload.
Buat database dan user khusus Nextcloud (ganti PasswordKuat123!):
mariadb -u root
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PasswordKuat123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Catat nama database (nextcloud), user (nextcloud), dan password ini. Ketiganya diisi di installer web nanti.
Langkah 4: Unduh Nextcloud dan atur izin folder
Unduh rilis terbaru dari server resmi, cek checksum, lalu ekstrak ke /var/www/nextcloud:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
wget https://download.nextcloud.com/server/releases/latest.zip.sha256
sha256sum -c latest.zip.sha256 # harus: latest.zip: OK
unzip -q latest.zip -d /var/www/
Buat folder data di luar folder web, supaya file pengguna tidak bisa diakses langsung lewat browser:
mkdir -p /var/nextcloud-data
Ini langkah yang mencegah error "Can't write into config directory". Semua file Nextcloud harus dimiliki www-data, karena PHP-FPM berjalan sebagai user itu:
chown -R www-data:www-data /var/www/nextcloud /var/nextcloud-data
find /var/www/nextcloud -type d -exec chmod 750 {} \;
find /var/www/nextcloud -type f -exec chmod 640 {} \;
chmod 770 /var/nextcloud-data
Cek hasilnya. Kolom pemilik harus www-data www-data:
ls -ld /var/www/nextcloud /var/www/nextcloud/config /var/www/nextcloud/apps /var/nextcloud-data
Aturan penting setelah ini: setiap menjalankan perintah occ, selalu lewat user www-data (sudo -u www-data php occ ...), jangan sebagai root. Menjalankan occ sebagai root membuat file baru milik root dan memunculkan lagi error izin.
Langkah 5: Konfigurasi Nginx
Konfigurasi ini diringkas dari konfigurasi Nginx resmi Nextcloud, versi HTTP dulu supaya bisa langsung dites. HTTPS ditambahkan di Langkah 7.
Nonaktifkan situs default, lalu buat file baru:
rm -f /etc/nginx/sites-enabled/default
nano /etc/nginx/sites-available/nextcloud
Isi file (ganti cloud.domainanda.com):
upstream php-handler {
server unix:/run/php/php8.4-fpm.sock;
}
map $arg_v $asset_immutable {
"" "";
default ", immutable";
}
server {
listen 80;
listen [::]:80;
server_name cloud.domainanda.com;
server_tokens off;
root /var/www/nextcloud;
client_max_body_size 2G;
client_body_timeout 300s;
client_body_buffer_size 512k;
fastcgi_buffers 64 4K;
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" 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;
fastcgi_hide_header X-Powered-By;
include mime.types;
types {
text/javascript mjs;
}
index index.php index.html /index.php$request_uri;
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
return 301 /index.php$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ ^/(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ { return 404; }
location ~ \.php(?:$|/) {
rewrite ^/(?!index|remote|public|cron|status|ocs\/v[12]|ocs-provider\/.+|core\/ajax\/update|updater\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_pass php-handler;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
# aktifkan baris ini SETELAH HTTPS terpasang (Langkah 7):
#fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_intercept_errors on;
fastcgi_request_buffering on;
fastcgi_read_timeout 300s;
fastcgi_max_temp_file_size 0;
}
location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463$asset_immutable";
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" 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;
access_log off;
}
location ~ \.(otf|woff2?)$ {
try_files $uri /index.php$request_uri;
expires 7d;
access_log off;
}
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
Aktifkan dan tes:
ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
nginx -t # harus: syntax is ok, test is successful
systemctl reload nginx
Langkah 6: Jalankan installer web
Buka http://cloud.domainanda.com (atau http://IP-SERVER) di browser, lalu isi:
|
Kolom |
Isi |
|---|---|
|
Akun admin |
username dan password admin baru (bebas) |
|
Folder data |
|
|
Jenis database |
MySQL/MariaDB |
|
User database |
|
|
Password database |
password dari Langkah 3 |
|
Nama database |
|
|
Host database |
|
Klik Install. Proses bisa 1 sampai 3 menit. Kalau ditawari aplikasi rekomendasi, boleh dilewati dulu supaya instalasi lebih cepat.
Alternatif lewat terminal (hasilnya sama, berguna kalau browser timeout):
apt install -y sudo
cd /var/www/nextcloud
sudo -u www-data php occ maintenance:install \
--database "mysql" --database-name "nextcloud" \
--database-user "nextcloud" --database-pass "PasswordKuat123!" \
--admin-user "admin" --admin-pass "PasswordAdminAnda" \
--data-dir "/var/nextcloud-data"
sudo -u www-data php occ config:system:set trusted_domains 1 --value=cloud.domainanda.com
Setelah instalasi, tambahkan cache dan pengaturan dasar:
cd /var/www/nextcloud
sudo -u www-data php occ config:system:set memcache.local --value='\OC\Memcache\APCu'
sudo -u www-data php occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
sudo -u www-data php occ config:system:set redis host --value=localhost
sudo -u www-data php occ config:system:set redis port --value=6379 --type=integer
sudo -u www-data php occ config:system:set default_phone_region --value=ID
sudo -u www-data php occ config:system:set maintenance_window_start --type=integer --value=1
sudo -u www-data php occ maintenance:repair --include-expensive
sudo -u www-data php occ db:add-missing-indices
Langkah 7: HTTPS, cron, dan pengecekan akhir
HTTPS gratis dengan Let's Encrypt (opsional, butuh domain yang sudah mengarah ke IP server dan port 80/443 terbuka):
apt install -y certbot python3-certbot-nginx
certbot --nginx -d cloud.domainanda.com --redirect
Certbot otomatis menambahkan blok listen 443 ssl dan redirect dari HTTP. Setelah itu, buka lagi /etc/nginx/sites-available/nextcloud dan lakukan dua hal:
- Hapus tanda
#pada barisfastcgi_param HTTPS on;. - Tambahkan baris HSTS di dalam blok
serveryang berisilisten 443:
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
Lalu terapkan dan beri tahu Nextcloud bahwa alamatnya sekarang HTTPS:
nginx -t && systemctl reload nginx
cd /var/www/nextcloud
sudo -u www-data php occ config:system:set overwrite.cli.url --value=https://cloud.domainanda.com
sudo -u www-data php occ config:system:set overwriteprotocol --value=https
certbot renew --dry-run # tes perpanjangan otomatis
Cron untuk tugas latar belakang. Nextcloud perlu menjalankan cron.php tiap 5 menit:
crontab -u www-data -e
Tambahkan baris ini, simpan:
*/5 * * * * php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1
Lalu pilih mode Cron:
sudo -u www-data php /var/www/nextcloud/occ background:cron
Pengecekan akhir. Login sebagai admin, buka Administration settings → Overview. Halaman ini menampilkan peringatan keamanan dan konfigurasi yang masih kurang. Dari terminal, cek status dengan:
sudo -u www-data php /var/www/nextcloud/occ status
sudo -u www-data php /var/www/nextcloud/occ setupchecks
Troubleshooting
"Can't write into config directory" atau "Cannot write into apps directory". Penyebabnya hampir selalu pemilik file bukan www-data, biasanya karena file diekstrak atau occ dijalankan sebagai root. Perbaiki dengan:
chown -R www-data:www-data /var/www/nextcloud /var/nextcloud-data
chmod 750 /var/www/nextcloud/config /var/www/nextcloud/apps
ls -l /var/www/nextcloud/config # config.php harus milik www-data
grep -E '^(user|group)' /etc/php/8.4/fpm/pool.d/www.conf # harus www-data
systemctl restart php8.4-fpm
Kalau masih gagal, cek apakah PHP-FPM yang dipakai Nginx memang versi 8.4: baris upstream di konfigurasi Nginx harus menunjuk ke /run/php/php8.4-fpm.sock, dan file itu harus ada (ls /run/php/).
Error 502 Bad Gateway. PHP-FPM mati atau path socket salah. Jalankan systemctl status php8.4-fpm dan tail -n 50 /var/log/nginx/error.log.
apt update error 404 untuk packages.sury.org. Masih ada sisa repo sury. Ulangi Langkah 1a, lalu grep -r sury /etc/apt/ untuk memastikan tidak ada yang tertinggal.
"Access through untrusted domain". Tambahkan domain atau IP yang dipakai:
sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 2 --value=192.168.1.10
Halaman putih atau error 500. Lihat log Nextcloud di /var/nextcloud-data/nextcloud.log dan log PHP dengan journalctl -u php8.4-fpm -n 50.
Upload file besar gagal. Pastikan client_max_body_size di Nginx dan upload_max_filesize / post_max_size di /etc/php/8.4/fpm/php.ini sama besar, lalu restart php8.4-fpm dan reload nginx.
Upgrade Nextcloud di kemudian hari. Jalankan updater bawaan sebagai www-data:
sudo -u www-data php /var/www/nextcloud/updater/updater.phar
Sumber
- Nextcloud changelog (35.0.3, 12 November 2026)
- Nextcloud 35 system requirements (PHP 8.3/8.4/8.5, Debian 13)
- Nextcloud Maintenance and Release Schedule
- Konfigurasi Nginx resmi Nextcloud
- Nextcloud 35 upgrade notes (WZ-IT) (PHP 8.2 dihapus di versi 35)
- · @kiya