Tuesday, November 6, 2012

Ubah alamat localhost pada XAMPP.txt

Ubah alamat localhost pada XAMPP

Pada postingan kali ini, saya mau sharing tentang cara mengubah alamat localhost.

Biasanya, ketika kita menginstall XAMPP, lalu ingin memanggil aplikasi kita, yang kita lakukan adalah mengetikan alamat
localhost/nama_folder pada address bar browser.

Yang akan saya sharing pada postingan kali  ini adalah cara mengubah pemanggilan folder pada XAMPP. Jadi nantinya,
kita tidak harus mengetikan alamat localhost/nama_folder, kita hanya tinggal mengetikan alamat xyz.com untuk memanggil aplikasi kita.

Langkah pertama, buka file hosts yang ada pada direktori E:\WINDOWS\system32\drivers\etc dengan notepad,
(double click file hosts –> pada windows open with, click notepad)

    nb : pada komputer saya, file system saya taruh di drive E:\, di kebanyakan komputer, biasanya file system ada pada drive C:\

isi dari file hosts kurang lebih seperti dibawah ini :
01    # Copyright (c) 1993-1999 Microsoft Corp.
02    #
03    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
04    #
05    # This file contains the mappings of IP addresses to host names. Each
06    # entry should be kept on an individual line. The IP address should
07    # be placed in the first column followed by the corresponding host name.
08    # The IP address and the host name should be separated by at least one
09    # space.
10    #
11    # Additionally, comments (such as these) may be inserted on individual
12    # lines or following the machine name denoted by a '#' symbol.
13    #
14    # For example:
15    #
16    #      102.54.94.97     rhino.acme.com          # source server
17    #       38.25.63.10     x.acme.com              # x client host
18   
19    127.0.0.1       localhost

Langkah kedua, setelah anda membuka file hosts, anda harus menambahkan alamat domain yang nantinya akan anda gunakan sebagai alamat virtual host folder website anda.

untuk menambahkan alamat domain baru anda, tambahkan teks 127.0.0.1 nama_website.com lalu letakan di bawah teks 127.0.0.1 localhost
01    # For example:
02     #
03     #      102.54.94.97     rhino.acme.com          # source server
04     #       38.25.63.10     x.acme.com              # x client host
05   
06     127.0.0.1       localhost
07   
08    #tambahkan alamat disini :
09   
10    127.0.0.1       bw2.com

setelah melakukan dua langkah diatas, sekarang saatnya kita mengedit settingan server XAMPP, lakukan langkah-langkah dibawah ini :

langkah pertama, buka file httpd-vhosts.conf yang ada pada direktori E:\xampp\apache\conf\extra.

buka file tersebut dengan menggunakan notepad.

tambahkan teks dibawah ini pada file httpd-vhosts.conf
01   
02   
03    ServerAdmin admin@bw2.com
04   
05    DocumentRoot /xampp/htdocs/bw2
06   
07    ServerName bw2.com
08   
09    ServerAlias bw2.com
10   
11   


kurang lebih, nantinya file tersebut akan jadi seperti dibawah ini :
01    #
02    # Virtual Hosts
03    #
04    # If you want to maintain multiple domains/hostnames on your
05    # machine you can setup VirtualHost containers for them. Most configurations
06    # use only name-based virtual hosts so the server doesn't need to worry about
07    # IP addresses. This is indicated by the asterisks in the directives below.
08    #
09    # Please see the documentation at
10    #
11    # for further details before you try to setup virtual hosts.
12    #
13    # You may use the command line option '-S' to verify your virtual host
14    # configuration.
15   
16    #
17    # Use name-based virtual hosting.
18    #
19    ##NameVirtualHost *:80
20   
21    #
22    # VirtualHost example:
23    # Almost any Apache directive may go into a VirtualHost container.
24    # The first VirtualHost section is used for all requests that do not
25    # match a ServerName or ServerAlias in any block.
26    #
27    ##
28     ##ServerAdmin postmaster@dummy-host.localhost
29     ##DocumentRoot "E:/xampp/htdocs/dummy-host.localhost"
30     ##ServerName dummy-host.localhost
31     ##ServerAlias www.dummy-host.localhost
32     ##ErrorLog "logs/dummy-host.localhost-error.log"
33     ##CustomLog "logs/dummy-host.localhost-access.log" combined
34    ##

35   
36    ##
37     ##ServerAdmin postmaster@dummy-host2.localhost
38     ##DocumentRoot "E:/xampp/htdocs/dummy-host2.localhost"
39     ##ServerName dummy-host2.localhost
40     ##ServerAlias www.dummy-host2.localhost
41     ##ErrorLog "logs/dummy-host2.localhost-error.log"
42     ##CustomLog "logs/dummy-host2.localhost-access.log" combined
43    ##

44   
45   
46   
47    ServerAdmin admin@bw2.com
48   
49    DocumentRoot /xampp/htdocs/bw2
50   
51    ServerName bw2.com
52   
53    ServerAlias bw2.com
54   
55   


oke, proses penambahan alamat domain pada server local selesai di lakukan, langkah terakhir, anda harus mereset service APACHE pada windows XP…,

caranya, masuk ke Control Panel –> Administrative Tools –> Services –> cari “services Apache” –> Click Kanan lalu click Restart

0 comments: