Mungkin pembaca sudah tahu maksudnya virtual host, jadi misalkan ada arief.com itu nanti ngarah ke var/www/arief atau ke ~/arief, jadi kalo kita ngetik arief.com di browser, yang jalan tu file di ~/arief, begitu. Langkah pertama adalah ngedit file hosts linux:
sudo gedit /etc/hosts
Selanjutnya tambahin settingan berikut di filenya:
127.0.0.1 arief.com
Contoh file hosts yang sudah diedit di komputer saya:
127.0.0.1 localhost 127.0.1.1 ariefsam-desktop 127.0.0.1 arief.com # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
DocumentRoot /home/ariefsam/arief.com | |
ServerName arief.com | |
ServerAlias arief.com | |
</VirtualHost> |
Sekarang mari kita restart networking ubuntu dan service apache.
sudo /etc/init.d/networking restart
Restart juga apachenya:
/etc/init.d/apache2 restart
Sekarang begitu akses arief.com/index.php, di komputer saya bertuliskan “arief.com berhasil”. (Arief Hidayatulloh)
Tidak ada komentar:
Posting Komentar
Jika Anda memiliki tanggapan dan pertanyaan silakan isi form komentar berikut, kami akan menjawabnya segera. :)