Install nginx dengan command
apt-get install nginx
Install MariaDB dengan command
apt-get install mariadb-server mariadb-client
agar MariaDB aman maka lakukan command berikut
mysql_secure_installation
ketika muncul tampilan prompt, jawab sesuai di bawah ini :
apt-get install nginx
Install MariaDB dengan command
apt-get install mariadb-server mariadb-client
agar MariaDB aman maka lakukan command berikut
mysql_secure_installation
ketika muncul tampilan prompt, jawab sesuai di bawah ini :
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
kemudian restart MariaDB dengan command
/etc/ini.d/mysql restart
Install PHP 7.1 FPM dan Modul-modulnya
Import signing key dan aktifkan PPA (Personal Package Archive) pihak ketiga dengan command
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
Kemudian update debian anda dengan command
apt-get update
Jika terjadi error berikut ini :
Reading package lists... Done
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
E: Failed to fetch https://packages.sury.org/php/dists/stretch/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.
ketika error di atas berarti harus ada paket yang di install, dengan command
apt-get install ca-certificates apt-transport-https
Kemudian lakukan update lagi.
Kemudian install PHP 7.1 beserta modulnya dengan command
apt-get install php7.1-fpm php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-apcu php7.1-smbclient php7.1-ldap php7.1-redis php7.1-gd php7.1-xml php7.1-intl php7.1-json php7.1-imagick php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl
Edit configurasi PHP7.1 di /etc/php/7.1/fpm/php.ini dengan command
nano /etc/php/7.1/fpm/php.ini
kemudian edit konfigurasi seperti dibawah ini dan save :
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
max_execution_time = 360
cgi.fix_pathinfo = 0
date.timezone = America/Chicago
Membuat Database NextCloud
Sebelum membuat database kita harus masuk mysql dengan user root dengan command
mysql -u root -p
Buat database dengan nama nextcloud dengan command
CREATE DATABASE nextcloud;
Buat user dengan nama nextclouduser beserta passwordnya dengan command
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';
Beri akses full user tersebut ke database dengan command
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
Simpan pergantiannya dan kemudian keluar dari mode mysql dengan command
FLUSH PRIVILEGES;
EXIT;
Download NextCloud Terbaru
Download NextCloud Terbaru di Website resminya dengan command
wget https://download.nextcloud.com/server/releases/nextcloud-15.0.0.zip
Install unzip untuk ekstrak nextcloud dengan command
apt-get install unzip
Kemudian extract nextcloud dengan command
unzip nextcloud-15.0.0.zip
Pindahkan extract nextcloud ke /var/www/html/
mv nextcloud/ /var/www/html/
Beri hak akses ke folder nextcloud dengan command
chown -R www-data:www-data /var/www/html/nextcloud/
chmod -R 755 /var/www/html/nextcloud/
Membuat Sertificate SSL untuk Nginx dengan OpenSSL
Pembuatan sertifikat SSL untuk Nginx dengan OpenSSL dengan command
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/nginx.key -out /etc/ssl/nginx.crt
Konfigurasi Nginx Agar Dapat Menjalankan NextCloud
Edit konfigurasi nginx di /etc/nginx/sites-available/default dengan command
nano /etc/nginx/sites-available/nextcloud
Masukkan konfigurasi seperti berikut ini :
server {
listen 80;
server_name _;
autoindex on;
# Add headers to serve security related headers
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Path to the root of your installation
root /var/www/html/nextcloud/;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
# last;
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location ~ /.well-known/acme-challenge {
allow all;
}
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
# Disable gzip to avoid the removal of the ETag header
gzip off;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location / {
rewrite ^ /index.php$uri;
}
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/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* \.(?:css|js)$ {
try_files $uri /index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
}
listen 443 ssl;
ssl_certificate /etc/ssl/nginx.crt;
ssl_certificate_key /etc/ssl/nginx.key;
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
}
Kemudian restart nginx dengan command
/etc/ini.d/nginx restart
Buka Browser anda kemudian ketikkan https://alamat_ip
anda akan melihat setup dari nextcloud

Buatlah admin accont dan password
masukkan user untuk masuk database : nextclouduser
password : sesuaikan seperti yang anda konfigurasi waktu pembuatan user tadi
database : nextcloud
host : localhost
Kemudian Install/Next untuk Instalasi pertama, setelah Intalasi selesai anda bisa login menggunakan admin account dan password yang sudah anda buat

EmoticonEmoticon