1. Open the Apache httpd.conf file to find
# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf
This section removes the "#" in front of the include conf/extra/httpd-vhosts.conf.
2. Modify the Hosts file located in the (Win7) c:/windows/system32/drivers/etc/directory
Add a section: 127.0.0.1 x.acme.com (the domain name you use to access)
3. I use the Wamp package, so to the C:/wamp/bin/apache/apache2.2.11/conf/extra directory
Modify File httpd-vhosts.conf
Namevirtualhost default is as follows:
Namevirtualhost *:80
Increase:
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html"
ServerName x.acme.com
Errorlog "Logs/x.acme.com-error.log"
Customlog "Logs/x.acme.com-access.log" common
</VirtualHost>
Change it and restart the server.
Enter http://x.acme.com in the browser to go to your directory.
Of course if you want to add the virtual host on the existing Web server, then the original localhost service to be able to use, you need to add something on the basis above:
In the Hosts file, add: 127.0.0.1 localhost
and add in the httpd-vhosts.conf file:
<virtualhost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/"
ServerName localhost
Errorlog "Logs/localhost-error.log"
Customlog "Logs/localhost-access.log" common
</VirtualHost>
Local machine Apache configuration domain-based virtual host detailed