Tutorial install Joomla di Ubuntu 20.04 dengan Nginx, MySQL/MariaDB, PHP (LEMP stack) serta SSL Let’s Ecnrypt.
Sebelum ke tutorial inti sebaiknya, update system Linux dan install unzip
apt update -y apt install unzip -y
Buat direktori untuk penyimpanan web Joomla
mkdir -p /var/www/html/joomla
Penting: Hubungkan domain ke server agar nanti saat request SSL gratis Letsencrypt berhasil.
Langkah 1 – Install Nginx
Install Nginx stable version
apt install nginx -y
Jalankan service Nginx
systemctl start nginx
Aktifkan Nginx saat booting
systemctl enable nginx
Langkah 2 – Install MariaDB
Install MariaDB 10.5, ini perintah untuk menambah repositorynya
apt-get install software-properties-common apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main'
Perintah untuk update, start, mengaktifkan mariadb.service
saat reboot dan atur password root
apt update -y systemctl start mariadb-server systemctl enable mariadb mysql_secure_installation
Silahkan disesuaikan
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): Enter aja OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] Y Enabled successfully! Reloading privilege tables.. ... Success! You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Ketik password Re-enter new password: Ulangi ketik password Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Langkah 3 – Install PHP
Install versi PHP, sebagai info Ubuntu 20.04 sudah PHP7.4
apt install php-phpdbg php-fpm php-curl php-gd php-imap php-interbase php-intl php-ldap php-readline php-pspell php-tidy php-xmlrpc php-json php-sybase php-mysql php-opcache php-bz2 php-mbstring php-xml php-enchant php-gmp php-soap php-zip php-bcmath php-pdo -y
Start dan aktifkan saat boot
systemctl start php-fpm systemctl enable php-fpm
Atur konfigurasi PHP, seperti maksimal upload dan memory yang digunakan oleh PHP
nano /etc/php/7.4/fpm/php.ini
Cari baris-baris berikut dan sesuaikan
date.timezone = "Asia/Jakarta" post_max_size = 32M upload_max_filesize = 64M memory_limit = 512M
Restart php-fpm
systemctl restart php7.4-fpm
Langkah 4 – Membuat virtual host Joomla
Membuat file konfigurasi virtual host di /etc/nginx/sites-available/
.
nano /etc/nginx/sites-available/joomla.idnetter.com.conf
Isi dengan kode di bawah ini, silahkan ganti domain idnetter.com.
server { listen *:80; server_name idnetter.com www.idnetter.com; root /var/www/html/joomla; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_intercept_errors on; fastcgi_hide_header X-Powered-By; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|\.htpasswd) { deny all; return 404; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|webp|ico|svg|eot|otf|woff|woff2|ttf|ogg)$ { expires 30d; error_log off; access_log /dev/null; } location ~ .*\.(js|css)?$ { expires 12h; error_log off; access_log /dev/null; } }
Selanjutnya, buat symbolic link ke sites-enabled
ln -s /etc/nginx/sites-available/joomla.idnetter.com.conf /etc/nginx/sites-enabled/joomla.idnetter.com.conf
Restart Nginx
systemctl restart nginx
Langkah 5 – Install Letsencrypt
Perintah untuk Install Let’s Ecnrypt sepaket dengan certbot
apt install letsencrypt
Generate dhparam
openssl dhparam -dsaparam -out /etc/nginx/dhparam.pem 4096
Install SSL Let’s Encrypt untuk domain idnetter.com
certbot certonly --rsa-key-size 4096 --webroot --agree-tos --no-eff-email --email [email protected] -w /var/www/html/joomla -d idnetter.com -d www.idnetter.com
Edit virtual host Nginx agar bisa diakses HTTPS
nano /etc/nginx/sites-available/joomla.idnetter.com.conf
Ganti atau sesuaikan seperti kode berikut
server { listen 80; server_name idnetter.com www.idnetter.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name idnetter.com www.idnetter.com; root /var/www/html/joomla; index index.php index.html index.htm; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers on; ssl_dhparam /etc/nginx/dhparam.pem; ssl_ecdh_curve secp384r1; ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; server_tokens off; resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 5s; add_header X-Frame-Options SAMEORIGIN; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options nosniff; add_header Strict-Transport-Security "max-age=63072000" always; location / { try_files $uri $uri/ /index.php?$args; location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_intercept_errors on; fastcgi_hide_header X-Powered-By; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|\.htpasswd) { deny all; return 404; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|webp|ico|svg|eot|otf|woff|woff2|ttf|ogg)$ { expires 30d; error_log off; access_log /dev/null; } location ~ .*\.(js|css)?$ { expires 12h; error_log off; access_log /dev/null; } }
Restart Nginx
systemctl restart nginx
Langkah 6 – Membuat database Joomla
masuk ke root MySQL dan buat database
mysql -uroot -p
Masukkan pasword root MySQL, selanjutnya ini perintah untuk membuat nama dan user Database
CREATE DATABASE idnetter_joomla; CREATE USER idnetter_joomla@localhost IDENTIFIED BY 'katasandi123'; GRANT ALL PRIVILEGES on idnetter_joomla.* TO idnetter_joomla@localhost; FLUSH PRIVILEGES; exit;
Langkah 7 – Download Joomla
Masuk ke /var/www/html
, dan download Joomla terbaru
Cek link download Joomla terbaru disini
cd /var/www/html/joomla wget -O joomla.zip https://downloads.joomla.org/cms/joomla3/3-9-19/Joomla_3-9-19-Stable-Full_Package.zip?format=zip
Ekstrak file Joomla
unzip joomla.zip
Setelah selesai, ganti permission direktori /var/www
agar Joomla bisa read/write
chown -R www-data:www-data /var/www
Tinggal eksekusi Joomla melaui web browser.
Langkah 8 – Install Joomla via Browser
Install Joomla melalui web browser, silahkan akses IP server atau domain yang telah dikonfigurasikan. Cek gambar di bawah ini:
Langkah 9 – Hapus direktori instalasi Joomla
Sebagai langkah perlindungan, hapus direktori installation
Klik tombol Remove “installation” folder
Atau bisa melalui command line
rm -rf /var/www/html/joomla/installation
Langkah 10 – SEO Settings (URL Rewrite) Joomla
Masuk ke Administrator Joomla: System > Global Configuration > SEO Settings
Aktifkan:
- Use URL Rewriting
- Add Suffix to URL
Selesai teman-teman, selamat mencoba dan semoga bermanfaat.
kenapa ya punya saya error 500 saat dibuka
Check lognya di /var/log/nginx/ ada file error.log