To keep our job as a professional web programmer to keep it neat in the localhost, create a virtual host is a good first step. Especially if we have a lot of work. Well what a virtual host and how to create a virtual host ...
What is virtual host?
VirtualHost is artificial or simulated host host on apache server or localhost. By default the host address of our server is http://localhost/bla..bla .. We can create an artificial host for simulation as real server host. Suppose, we want to create a virtual host name with the name http://latihan1.com. With a virtual host that later we can make more than one domain in which we store in the directory C: \ WWW.
How do I make it?
How to make it very easy, just follow STEP 2 below. I just tried it on Xampp, so should you want to try also to use Xampp :).
The steps:
Install XAMPP (Ensure that all service can run)
Open the hosts file in C: \ WINDOWS \ system32 \ drivers \ etc
Edit the hosts file and add the virtual host in the file (see example below), then save:
> Hosts file before the change:
# Copyright (c) Microsoft Corp 1993-2006. # # 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
Following the # lines or machine name denoted by a '#' symbol.
#
# For example:
#
# # Source server 102.54.94.97 rhino.acme.com
# # X client 38.25.63.10 x.acme.com host127.0.0.1 localhost
:: 1 localhost
Suppose we want to add a new virtual host: localhost 127.0.0.1 simakel.com below (see example below)
# Copyright (c) Microsoft Corp 1993-2006. #
# 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
Following the # lines or machine name denoted by a '#' symbol.
#
# For example:
#
# # Source server 102.54.94.97 rhino.acme.com
# # X client 38.25.63.10 x.acme.com host127.0.0.1 localhost
:: 1 localhost
127.0.0.1 simakel.com
We can also add a VirtualHost more than one, repeat step three if you want to add another VirtualHost.
Open the httpd.conf file in C: \ xampp \ apache \ conf, and then change the directory permissions that can be accessed by anyone. (See example below)
Find the code below:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all
</ Directory>
Then replace the code below:
<Directory "C:/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow, deny
Allow from all
</ Directory>
Save the file.
Then open the file httpd-vhosts.conf again in C: \ xampp \ apache \ conf \ extra, add the ServerName and DocumentRoot in the file. (See example below).
Find NameVirtualHost, then remove the comments (# #), so as shown below:
# # NameVirtualHost *: 80
Then replace the code below:
NameVirtualHost *: 80
Add your VirtualHost ServerName and DocumentRoot consists of.
You <VirtualHost *:80> # VirtualHost DocumentRoot C :/ www / ServerName simakel.com simakel.com </ VirtualHost> # To distinguish localhost with your VirtualHost: <VirtualHost *:80> DocumentRoot C :/ xampp / htdocs ServerName localhost < / VirtualHost>
Save the file.
Finally, create a folder with the name simakel.com in directory: C: \ www
Congratulations .... You already have a virtual host, if you want to create a new virtual host, repeat STEP 2 above from the beginning. Hope it helps ....
Well, this virtual host will be used in the next tutorial is about creating a web application with the CodeIgniter Framework.
What is virtual host?
VirtualHost is artificial or simulated host host on apache server or localhost. By default the host address of our server is http://localhost/bla..bla .. We can create an artificial host for simulation as real server host. Suppose, we want to create a virtual host name with the name http://latihan1.com. With a virtual host that later we can make more than one domain in which we store in the directory C: \ WWW.
How do I make it?
How to make it very easy, just follow STEP 2 below. I just tried it on Xampp, so should you want to try also to use Xampp :).
The steps:
Install XAMPP (Ensure that all service can run)
Open the hosts file in C: \ WINDOWS \ system32 \ drivers \ etc
Edit the hosts file and add the virtual host in the file (see example below), then save:
> Hosts file before the change:
# Copyright (c) Microsoft Corp 1993-2006. # # 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
Following the # lines or machine name denoted by a '#' symbol.
#
# For example:
#
# # Source server 102.54.94.97 rhino.acme.com
# # X client 38.25.63.10 x.acme.com host127.0.0.1 localhost
:: 1 localhost
Suppose we want to add a new virtual host: localhost 127.0.0.1 simakel.com below (see example below)
# Copyright (c) Microsoft Corp 1993-2006. #
# 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
Following the # lines or machine name denoted by a '#' symbol.
#
# For example:
#
# # Source server 102.54.94.97 rhino.acme.com
# # X client 38.25.63.10 x.acme.com host127.0.0.1 localhost
:: 1 localhost
127.0.0.1 simakel.com
We can also add a VirtualHost more than one, repeat step three if you want to add another VirtualHost.
Open the httpd.conf file in C: \ xampp \ apache \ conf, and then change the directory permissions that can be accessed by anyone. (See example below)
Find the code below:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all
</ Directory>
Then replace the code below:
<Directory "C:/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow, deny
Allow from all
</ Directory>
Save the file.
Then open the file httpd-vhosts.conf again in C: \ xampp \ apache \ conf \ extra, add the ServerName and DocumentRoot in the file. (See example below).
Find NameVirtualHost, then remove the comments (# #), so as shown below:
# # NameVirtualHost *: 80
Then replace the code below:
NameVirtualHost *: 80
Add your VirtualHost ServerName and DocumentRoot consists of.
You <VirtualHost *:80> # VirtualHost DocumentRoot C :/ www / ServerName simakel.com simakel.com </ VirtualHost> # To distinguish localhost with your VirtualHost: <VirtualHost *:80> DocumentRoot C :/ xampp / htdocs ServerName localhost < / VirtualHost>
Save the file.
Finally, create a folder with the name simakel.com in directory: C: \ www
Congratulations .... You already have a virtual host, if you want to create a new virtual host, repeat STEP 2 above from the beginning. Hope it helps ....
Well, this virtual host will be used in the next tutorial is about creating a web application with the CodeIgniter Framework.
Labels:
Hosting And Domain,
Network
Thanks for reading Creating a Virtual Host Using Xampp. Please share...!
0 Komentar untuk "Creating a Virtual Host Using Xampp"