Apache local multi-domain configuration (wampserver local multi-domain configuration)

Source: Internet
Author: User



When we are developing locally. Usually in the browser input http://localhost/project directory name test Web files, you have not thought in the local browser, enter the name of their own set into the project directory, name related issues.


For example, I want to configure a primary domain name www.test.com and a level two domain name img.test.com (in fact, the two-level domain name is the same as configuring another separate domain name)


The first step: Open the Local System installation folder, for example, I installed WINDOWS8, installed on the C drive, into the folder C:\Windows\System32\drivers\etc
Find a file called hosts and open it with Notepad:

Add the following code at the end of the file:


127.0.0.1 www.test.com127.0.0.1 www.test.com127.0.0.1 localhost

Save when you are finished typing.


Step Two: open Apache installation location, as I use Wampserver. The installation folder is: D:\wamp\bin\apache\Apache2.2.21


Open a directory called Conf, which is the Apache configuration directory


Open a file called httpd.conf


Search for Directory and find one such as: <directory "d:/wamp/www/" >


A row. After you see the code

Put the code:


Order Deny,allow deny from all to    127.0.0.1


Change to:
Order Allow,deny allow from all    


Step Three:

In the httpd.conf file just now. Search for include conf/extra/httpd-vhosts.conf

remove the # in front of it. Then save this file


Fourth Step: Open the Conf folder next subfolder: Extra, find a httpd-vhosts.conf this file. Usually the last file,

at the end of the file, add:


<virtualhost *:80>    documentroot "d:/wamp/www/test"    ServerName www.test.com </VirtualHost> < VirtualHost *:80>    documentroot "d:/wamp/www/test/img"    ServerName img.test.com </VirtualHost> < VirtualHost *:80>    documentroot "d:/wamp/www/"    ServerName localhost </VirtualHost>




This basis folder according to their own Apache Files folder to adjust their own, my Apache working folder for d:/wamp/www/, changed to their Apache working folder can be.


A final step. Restart Apache, enter your browser: www.test.com will appear test default content Directory

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

Apache local multi-domain configuration (wampserver local multi-domain configuration)

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.