Merubah Nama Domain "localhost"

Bagi temen-temen semua khususnya yang hoby coding dengan php mungkin sudah nggak asing lagi dengan kata “localhost.  localhost merupakan domain default bawaan webserver. (misal: xampp, wamp, appserv, easyphp, dsb ) kemudian ingin mengetahui hasil instalan web server di komputer kita berhasil atau tidak, pasti yang pertama kali mengisi address bar browser dengan “localhost”. Nah pernahkah anda punya keinginan untuk mengubah dengan nama lain biar seolah-olah kita benar-benar mengakses web dengan domain yang telah kita beli di jasa penyedia hosting.
misal kita ingin aplikasi web yang telah di buat di localhost ketika mengaksesnya lewat browser bukan lagi http://localhost/ tetapi http://namadomain.com/ maka kita perlu menambahkan host ke server lokal di komputer kita. Dengan kata lain kita ingin membuat nama dari localhost.
Langkah pertama : Pertama buka Windows Explorer, kemudian akses alamat ini : C:WINDOWSsystem32driversetc. Setelah dibuka maka akan menemukan beberapa file antara lain : host, lmhost, networks, protocol, dan services.
Kedua : Edit file host pakai notepad++  dsb. Setelah dibuka akan muncul text default :
======================================================
# 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 host
127.0.0.1 localhost
Setelah file tersebut dibuka tambahkan baris di bawah tulisan “127.0.0.1 localhost” sesuai dengan nama domain yang dikehendaki misal sukasuka.com. Jadi file tersebut setelah ditambahkan akan menjadi 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 host
127.0.0.1 localhost
127.0.0.1 domaingue.com

=====================================================
Setelah itu simpan atau Ctrl+S pada notepadnya. Kemudian buka browser dan ketikkan sukasuka.com maka akan diarahkan ke localhost kita...

0 Response to "Merubah Nama Domain "localhost""

Posting Komentar

powered by Blogger | WordPress by Newwpthemes | Converted by BloggerTheme