Linux

[Part 4] Konfigurasi VirtualHost Apache di Debian 10

Thursday, 17th September 2020

Seri lanjutan dari part 3.

F. Konfigurasi VirtualHost (tkj.net, siswa.tkj.net, cinta.bersemi.di.tkj.net dan smk.net)
    --- buat folder masing-masing vhost dahulu ---
1.	#mkdir /var/www/tkj.net
2.	#mkdir /var/www/siswa.tkj.net
3.	#mkdir /var/www/cinta.bersemi.di.tkj.net
4.	#mkdir /var/www/smk.net
    ---- buat isi halaman web nya ----
5.	#echo "<h1>tkj.net</h1>" > /var/www/tkj.net/index.html
6.	#echo "<h1>siswa.tkj.net</h1>" > /var/www/siswa.tkj.net/index.html
7.	#echo "<h1>cinta.bersemi.di.tkj.net</h1>" > /var/www/cinta.bersemi.di.tkj.net/index.html
8.	#echo "<h1>smk.net</h1>" > /var/www/smk.net/index.html
    ---- buat konfigurasi virtualhostnya -----
9.	#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/tkj.net.conf
10.	#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/siswa.tkj.net.conf
11.	#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/cinta.bersemi.di.tkj.net.conf
12.	#cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/smk.net.conf
    ---- edit filenya ----
13.	#nano /etc/apache2/sites-available/tkj.net.conf
    --- yg perlu di rubah hanya 2 baris ya---
        # However, you must set it for any further virtual host explicitly.
        ServerName tkj.net 
        DocumentRoot /var/www/tkj.net
    ----  lainnya tidak perlu di rubah ----- simpan Ctrl + x , Y
    Untuk virtualhost yang lainnya sama, tinggal di ubah saja di ServerName dan DocumentRoot
14. --- pembuatan simbolic link -----
    #/usr/sbin/a2ensite tkj.net.conf
    #/usr/sbin/a2ensite siswa.tkj.net.conf
    #/usr/sbin/a2ensite cinta.bersemi.di.tkj.net.conf
    #/usr/sbin/a2ensite smk.net.conf
    
15.	#/etc/init.d/apache2 restart
    ----- cek di web browser buka masing-masing domain, harusnya isinya sudah berbeda-beda.
    Selesai, ini tingkat "bisa", silahkan lanjutkan pelajari sampai tingkat "paham", dan selanjutnya "mahir".

Video tutorial:

Leave a Reply

Your email address will not be published. Required fields are marked *