Membuat virtual host

Tutorial kali ini mau mendongeng tentang virtual host:
langsung aja :

1. Buka file host yang ada di C:\WINDOWS\system32\drivers\etc
buka sebagai administrator ,
akan muncul code seperti ini :


#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

tambahkan di akhir code dengan nama domain sesuai yg anda inginkan, dalam tutorial ini saya menggunakan aircraft.com


#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

127.0.0.1 aircraft.com

kemudian masuk ke httpd.conf di  C:\xampp\apache\conf,
ganti kode dibawah ini

<Directory />
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
</Directory>

menjadi seperti ini

<Directory "C:/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

setelah itu masuk ke httpd-vhosts.conf di C:\xampp\apache\conf\extra

tambahkan kode berikut di akhir baris

<VirtualHost *>
DocumentRoot "d:\aircraft"
ServerName aircraft.com
<Directory "d:\aircraft">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs
ServerName localhost
</VirtualHost>

kemudian restart xampp anda,
jika kemudian anda mengetikan aircraft.com kemudian oleh xampp di direct ke aircraft.com/xampp, berarti settingan virtual host anda belum berhasil.
virtual host anda berhasil ketika dia meload struktur folder di directory d:\aircraft.

Advertisements