Contoh Kasus:
Berikut adalah langkah-langkah untuk mengonfigurasi webserver di Debian 12 dengan domain abdullah.net dan abdullah.org, tanpa SSL dan tanpa PHP atau database MySQL/MariaDB. Kita akan menggunakan Apache sebagai webserver.
1. Pastikan Server Terhubung ke Jaringan
- Pastikan IP server sudah diatur ke
192.168.103.31dan bisa diakses dari jaringan lokal. - Periksa koneksi menggunakan perintah:
ping 192.168.103.31
2. Update Sistem dan Install Apache
- Update daftar paket:
sudo apt update && sudo apt upgrade -y - Install Apache:
sudo apt install apache2 -y - Pastikan Apache berjalan:
sudo systemctl start apache2 sudo systemctl enable apache2 - Cek apakah webserver berjalan dengan membuka
http://192.168.103.31di browser. Anda seharusnya melihat halaman “Apache2 Debian Default Page.”
3. Konfigurasi Virtual Hosts untuk Domain
- Buat direktori untuk setiap domain:
sudo mkdir -p /var/www/abdullah.net sudo mkdir -p /var/www/abdullah.org - Setel kepemilikan direktori:
sudo chown -R www-data:www-data /var/www/abdullah.net sudo chown -R www-data:www-data /var/www/abdullah.org - Buat file konfigurasi untuk domain
abdullah.net:sudo nano /etc/apache2/sites-available/abdullah.net.confTambahkan konfigurasi berikut:<VirtualHost *:80> ServerName abdullah.net DocumentRoot /var/www/abdullah.net <Directory /var/www/abdullah.net> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/abdullah.net_error.log CustomLog ${APACHE_LOG_DIR}/abdullah.net_access.log combined </VirtualHost> - Buat file konfigurasi untuk domain
abdullah.org:sudo nano /etc/apache2/sites-available/abdullah.org.confTambahkan konfigurasi berikut:<VirtualHost *:80> ServerName abdullah.org DocumentRoot /var/www/abdullah.org <Directory /var/www/abdullah.org> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/abdullah.org_error.log CustomLog ${APACHE_LOG_DIR}/abdullah.org_access.log combined </VirtualHost> - Aktifkan konfigurasi virtual hosts:
sudo a2ensite abdullah.net.conf sudo a2ensite abdullah.org.conf - Nonaktifkan konfigurasi default:
sudo a2dissite 000-default.conf - Restart Apache untuk menerapkan perubahan:
sudo systemctl restart apache2
4. Uji Konfigurasi
- Tambahkan entri di file hosts komputer Anda untuk mengarahkan domain ke IP server:
- Di Linux/Mac:
sudo nano /etc/hosts - Di Windows, file terletak di
C:\Windows\System32\drivers\etc\hosts.
192.168.103.31 abdullah.net 192.168.103.31 www.abdullah.net 192.168.103.31 abdullah.org 192.168.103.31 www.abdullah.org - Di Linux/Mac:
- Buat file
index.htmluntuk masing-masing domain:- Untuk
abdullah.net:echo "<h1>Welcome to abdullah.net</h1>" | sudo tee /var/www/abdullah.net/index.html - Untuk
abdullah.org:echo "<h1>Welcome to abdullah.org</h1>" | sudo tee /var/www/abdullah.org/index.html
- Untuk
- Buka browser dan akses:
http://abdullah.nethttp://abdullah.org
Anda seharusnya melihat halaman yang sesuai dengan file index.html masing-masing domain.
5. Logging dan Debugging
- Periksa log jika terjadi masalah:
sudo tail -f /var/log/apache2/abdullah.net_error.log sudo tail -f /var/log/apache2/abdullah.org_error.log
Dengan langkah-langkah di atas, webserver untuk domain abdullah.net dan abdullah.org di Debian 12 telah berhasil dikonfigurasi tanpa SSL, PHP, atau database.