XAMPP Virtual Host Configuration--20150423

Source: Internet
Author: User

You need some top-level domain access to access your local project files instead of directory access, this time you need to configure the virtual host, to your directory binding a domain name (local words can be modified by the Hosts file arbitrarily binding what domain name such as www.a.com or Localdemo).
Now suppose you have two directories, one exists in/xampp/htdocs/5hoom and the other exists in/xampp/htdocs/chinadoto.
Now you want to access the local test www.5hoom.com the corresponding directory is/xampp/htdocs/5hoom, access www.chinadoto.com corresponding directory is/xampp/htdocs/chinadoto.
Understand the Apache configuration can actually be bypassed, because XAMPP is nothing more than integration of the Apache and other environmental integration package, the implementation of multi-domain name is through the configuration APache implementation.

Of course, there are many methods of online search, but the information on the Internet is reproduced to reprint, and some methods I doubt whether the verification is correct or not know. The following method is my own test, if you follow my configuration or can not implement local multi-domain debugging, it may be because of your XAMPP version and my inconsistency caused. You can tell me in the comments below and I'll give you answers. The following configuration is for the XAMPP Windows 1.7.1 version.

1, first modify the C disk windows\system32\drivers\etc directory of the Hosts file, open with Notepad, add:
127.0.0.1 www.5hoom.com
127.0.0.1 www.chinadoto.com

2. Open xampp\apache\conf\httpd.conf file, search ". Conf/extra/httpd-vhosts.conf ", make sure that there are no # annotations before, that is, ensure that the Vhosts virtual host configuration file is introduced.

Httpd-vhosts.conf is turned on, the default httpd.conf default configuration is disabled (ensure that the httpd-vhosts.conf file also opens the virtual host configuration, see 3rd), the domain name to access this IP will all point to vhosts.conf The first virtual host in the.

3, in the virtual host settings file xampp\apache\conf\extra\httpd-vhosts.conf set:
Cancel the # # in front of Namevirtualhost *:80 so that vhosts.conf is enabled and the default httpd.conf default configuration is invalidated. The virtual host configuration will only be set in httpd-vhosts.conf.
<virtualhost *:80>
Documentroot/xampp/htdocs/5hoom
ServerName www.5hoom.com
</VirtualHost>

<virtualhost *:80>
Documentroot/xampp/htdocs/chinadoto
ServerName www.chinadoto.com
</VirtualHost>

4, after setting the 3rd, you will find that the access to the localhost directly to the set of the path to a, the question in the 2nd has to say. That is, when the vhosts is turned on, the default httpd configuration will fail, and the default access points to the first setting in the vhosts. At this time you have to configure localhost directory to set back.
<virtualhost *:80>
documentroot/xampp/htdocs/
ServerName localhost
</VirtualHost>

At this point, XAMPP's virtual host setup is complete, now access localhost or the original XAMPP help guide, Access www.5hoom.com will be pointing to the bound 5hoom directory, Access Www.chinadoto.com will point to the bound Chinad Oto directory.

Reference: http://blog.163.com/mike_homis/blog/static/201049482009101223650238/

XAMPP Virtual Host Configuration--20150423

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.