Anda bisa membuat virtual host dan domain untuk server aphace di windows. Biasanya kita membuat web offline di localhost dengan alamat URL http://localhost/websiteku. Jika menggunakan virtual host anda bisa membuat URL nya menjadi websiteku.com tanpa harus terhubung ke internet. Cara membuatnya adalah sebagai berikut:
1. Masuk ke folder C:\Windows\System32\drivers\etc kemudian buka file hosts dengan program Notepad.
2. Kemudian pada baris paling bawah tambahkan:
127.0.0.1 localhost 127.0.0.1 webisteku.com
3. Berikutnya masuk ke folder C:\xampp\apache\conf\extra lalu edit file httpd-vhosts.conf dan pada barus paling bawah masukkan kode in:
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/xampp/htdocs" ServerName localhost ServerAlias localhost <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "d:\websiteku" ServerName websiteku.com ServerAlias websiteku.com ErrorLog logs/websiteku.com.log CustomLog logs/websiteku.com.log combined <Directory "d:\websiteku"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
4. Simpan lalu restart komputer anda.
Silahkan dicoba semoga bermanfaat.
(Visited 1,874 times, 1 visits today)