I have found many articles, but many of them are outdated and cannot take effect.
Http://blog.csdn.net/yuluo727282752/article/details/6944359 this article was written very well, recorded down, below for the full text reference.
When you complete a project, you always need to perform some tests, but some unexpected bugs may appear in your own tests. Therefore, you can configure a virtual host to solve bugs more conveniently, you can also test it during the demonstration.
Here are some of the methods I found online.
Development Environment: Wamp
Step 1: Configure localhost for apaceh
1. Use notepad to open the httpd file (for example, D: \ Wamp \ bin \ apache \ apache2.2.8 \ conf) in the Apache directory. Find the following module:
# Virtual hosts # include CONF/extra/httpd-vhosts.conf to remove # include CONF/extra/httpd-vhosts.conf before #, so that the httpd-vhosts virtual host file is enabled. At this time restart the Wamp environment, can not open localhost, need to configure in the httpd-vhosts.conf. My Wamp is installed on drive d
2. Open the httpd-vhosts file in notepad, configure the localhost virtual host, and modify it as follows by referring to the example in the httpd-vhosts file:
<Virtualhost *: 80> serveradmin DocumentRoot "D: \ Wamp \ www" servername localhostserveralias localhosterrorlog "logs/dummy-host.localhost-error.log" customlog "logs/dummy-host.localhost-access.log" common </virtualhost> modify the configuration as follows:
Modify DocumentRoot to the WWW directory (for example, D: \ Wamp \ www) in the local Wamp environment)
Change servername to localhost
3. Restart Apache and find that localhost can be opened normally. It is easy to configure localhost.
Step 2: configure the virtual host test.biuuu.com in apaceh
1. Copy the configuration Code as follows:
<Virtualhost *: 80>
Serveradmin
DocumentRoot "D:/Wamp/www/magento"
Servername www.jiangpeng.com
Errorlog "log/dummy-host2.localhost-error.log"
Customlog "logs/dummy-host2.localhost-access.log" common
</Virtualhost>
2. Open the host file (c: \ windows \ system32 \ drivers \ etc \ hosts) and add a line of code.
127.0.0.1 www. jiangpeng. com3, open www.jiangpeng.com in the browser and find the following error: 403 Forbidden Error
Forbidden
You don't have permission to access/on this server.
Analysis: This is mainly because the directory access permission is not set, and access to the Directory needs to be set!
4. Open the httpd file and find the following statement:
<Directory/> options followsymlinksallowoverride noneorder deny, allowdeny from all </directory>
Copy the above Code, modify the directory, and replace/with D:/Wamp/www/magento. Modify the virtualhost Code as follows:
<Virtualhost *: 80>
Serveradmin "D:/Wamp/www/magento"
Servername www.jiangpeng.com
Errorlog "log/dummy-host2.localhost-error.log"
Customlog "logs/dummy-host2.localhost-access.log" common
</Virtualhost>
<Directory "D:/Wamp/www/magento">
Options indexes followsymlinks
AllowOverride all
Order allow, deny
Allow from all
</Directory>
Test in the browser and find that it still cannot be opened. The system prompts the above 403 Forbidden error. Change deny from all to allow from all.
5. Restart Apache. The VM is successfully configured!
Considerations
1. directory path, such as D:/Wamp/www/magento
2. access permission. Change deny from all to allow from all.
3. Configure the virtual domain name host to point
4, httpd file, open include CONF/extra/httpd-vhosts.conf Module
5. Configure the virtual host in the httpd-vhosts file.