1. httpd. conf
Find the # include CONF/extra/httpd-vhosts.conf and remove the previous #, that is, the Comment
2. httpd. conf
Find (modify the directory path to the root directory of all your sites. My local directory is D: \ wwwroot)
Modify AllowOverride none-> AllowOverride all
<Directory "D:/wwwroot">
#
# Possible values for the options directive are "none", "all ",
# Or any combination:
# Indexes includes followsymlinks symlinksifownermatch execcgi Multiviews
#
# Note that "Multiviews" must be named * explicitly *-"Options all"
# Doesn' t give it to you.
#
# The options directive is both complicated and important. Please see
# Http://httpd.apache.org/docs/2.2/mod/core.html#options
# For more information.
#
Options indexes followsymlinks
#
# AllowOverride controls what directives may be placed in. htaccess files.
# It can be "all", "none", or any combination of the keywords:
# Options fileinfo authconfig limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow, deny
Allow from all
</Directory>
3. Find the httpd-vhosts.conf under the extra directory
<Virtualhost *: 80>
DocumentRoot D: \ apache \ htdocs
Serveradmin xxx@gmail.com
Servername localhost
</Virtualhost>
// Set the default site
<Virtualhost *: 80>
DocumentRoot D: \ wwwroot \ www.xxx.com // (www.xxx.com is the name of the folder in my storage system)
Servername www.xxxx.com
</Virtualhost>
// Set your own site. For specific log location settings, refer to the sample configuration.
4. Modify the C drive windows-> system32-> driver-> etc-> hosts file
Add: 127.0.0.1 www.xxx.com
Restart Apache. OK!