XAMPP virtual host configuration -- 20150423, xampp -- 20150423

Source: Internet
Author: User

XAMPP virtual host configuration -- 20150423, xampp -- 20150423

You need some top-level domain name access methods to access your local project files instead of directories. In this case, you need to configure the virtual host, bind a domain name to your directory (you can modify the hosts file to bind any domain name, such as www.a.com or localdemo ).
Assume that you have two directories, one exists in/xampp/htdocs/5 hoom, And the other exists in/xampp/htdocs/chinadoto.
Now you want to access the/xampp/htdocs/5 hoom directory corresponding to www.5hoom.com during local testing, and access the/xampp/htdocs/chinadoto directory corresponding to www.chinadoto.com.
You can bypass Apache configuration because XAMPP only integrates environment integration packages such as APache to implement multiple domain names through Apache configuration.

Of course, there are many methods to search online, but the information on the Internet is reprinted and reprinted. I doubt whether the verification is correct or not. The following method is tested by myself. If you still cannot debug local multi-domain names according to my configuration, it may be because your XAMPP version is inconsistent with mine. You can comment on me below and I will give you a one-by-one answer.The following configuration is for XAMPP Windows 1.7.1.

1. First modify the hosts file under the WINDOWS \ system32 \ drivers \ etc directory of drive C, open it in notepad, and add:
127.0.0.1 www.5hoom.com
127.0.0.1 www.chinadoto.com

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

The httpd-vhosts.conf is turned on, the default httpd. conf default configuration is invalid (make sure that the VM configuration is also enabled in the httpd-vhosts.conf file, see article 3rd), the domain name accessing this IP will all point to vhosts. the first VM in conf.

3. Set in the virtual host setting file xampp \ apache \ conf \ extra \ httpd-vhosts.conf:
Cancel NameVirtualHost *: # Before 80, so that vhosts. conf is enabled. The default httpd. conf configuration is invalid by default. The VM configuration will only be set in the httpd-vhosts.conf.
<VirtualHost *: 80>
DocumentRoot/xampp/htdocs/5 hoom
ServerNameWww.5hoom.com
</VirtualHost>

<VirtualHost *: 80>
DocumentRoot/xampp/htdocs/chinadoto
ServerNameWww.chinadoto.com
</VirtualHost>

4. After setting 3rd entries, you will find that accessing localhost directly points to the path of set a. This issue is explained in article 2nd. That is, after vhosts is enabled, the default httpd configuration will become invalid, and the default access will point to the first setting in vhosts. In this case, you need to configure the localhost directory.
<VirtualHost *: 80>
DocumentRoot/xampp/htdocs/
ServerName localhost
</VirtualHost>

Now, the XAMPP virtual host is set up. Accessing localhost is still the Help Guide of XAMPP. Accessing www.5hoom.com will point to the bound 5 hoom directory, accessing www.chinadoto.com directs to the bound chinadoto directory.

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

Related Article

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.