Membuat Virtualhost di Server Lokal


Ini cuma sebuah tutorial kecil bagi Anda pengguna web server Apache. Ini akan membuat URL yang ada pada server lokal Anda sama seperti URL pada server beneran.

Pengertiannya, Virtualhost adalah : Host buatan atau simulasi host pada server apache atau localhost untuk mengatur beberapa website/alamat website dalam satu server. Contoh anda harus mengakses website anda dengan http://localhost/web-ane dengan Virtualhost alamat website anda menjadi http://web-ane.com. Keren kan?? Selain keren, ini akan memudahkan Anda bagi yang mempunyai banyak job-job website. Karena dalam server lokal Anda dapat membuat banyak virtualhost sesuai dengan nama website aslinya.

Baiklah langsung saja kita membahas Cara membuat Virtualhost pada server lokal (localhost).

Pertama: Instal XAMPP (jika sudah terinstall, lanjut ke langkah berikutnya)

Kedua: Buka file host (C:\WINDOWS\system32\drivers\etc)

Copyright (c) 1993-1999 Microsoft Corp.
## 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 host127.0.0.1 localhost

Lalu tambahkan virtual host di dalam file tersebut dengan menambahkan Kode IP 127.0.0.1 belajar-web.com dibawah 127.0.0.1 localhost. Sehingga akan tampak seperti ini:
 Copyright (c) 1993-1999 Microsoft Corp.
## 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 host127.0.0.1 localhost127.0.0.1 web-ane.com


Anda bisa menambahkan beberapa virtualhost pada langkah diatas. Misal, 127.0.0.1 web-ane1.com, atau 127.0.0.1 web-ane2.com, dst..

Ketiga: Setting directory permission supaya bisa diakses oleh siapapun. Buka file httpd.conf di (C:\xampp\apache\conf).

Cari kode dibawah:


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

Ganti menjadi:


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


Kemudian Simpan file tadi.

Keempat: Tambahkan ServerName dan DocumentRoot pada file tersebut. Buka lagi file httpd-vhosts.conf di (C:\xampp\apache\conf\extra).
Cari NameVirtualHost.

##NameVirtualHost *:80

Hilangkan komentarnya (##), jadi seperti dibawah:


NameVirtualHost *:80

Tambahkan virtualhost Anda yang terdiri dari ServerName dan DocumentRoot.
   
    #VirtualHost Anda
    <VirtualHost *:80>    DocumentRoot C:/xampp/htdocs/belajar-web.com    ServerName belajar-web.com    </VirtualHost>       #Untuk membedakan localhost dengan virtualHost Anda:    <VirtualHost *:80>    DocumentRoot C:/xampp/htdocs    ServerName localhost    </VirtualHost>

Kemudian Save file tadi.

Kelima: Buat folder dengan nama file web-ane.com di C:\xampp\htdocs. Folder ini nantinya sebagai tempat menyimpan data2 website yag Anda kerjakan.

Selesai..? Selamat mencoba.






0 Response to "Membuat Virtualhost di Server Lokal"

eL - Habib Visitor

free counters

Google PageRank Checker Powered by  MyPagerank.Net
Yahoo bot last visit powered by MyPagerank.Net
SEO Stats powered by MyPagerank.Net