Multiple Domain names,
1. Use different ports to differentiate sites
2. Develop your own website
E: \ the_third_grade \ apache_workspace \ text01
3. configure our HTTP. conf file and start virtual hosts: Remove.
4. configure our httpd-vhosts.conf File
<VirtualHost 127.0.0.1:80> DocumentRoot "E:/the_third_grade/Apache_workspace/text01" DirectoryIndex my.html index.html index.htm index.php <Directory /> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory ></VirtualHost>
· Note !! The Virtual home directory seems to have a higher priority. At this time, the file in the Virtual home directory accessed through http: // localhost is also
· However, if http: // localhost/index.html is used, the index.html in the main directory is used.
· To avoid ambiguity, it is best to change the port number of the Virtual home directory. Do not set it to 80.
5. Add the ing between the IP address and the domain name in the hosts file.
In the hosts file under c: \ windows \ system32 \ drivers \ etc
Relationship between adding IP addresses and domain names
6. Test.
Next, add a new domain name: www.songjs2.com to bind with this IP address (through different ports)
1. Develop a new site E: \ the_third_grade \ apache_workspace \ text02
2. <virtualhost 127.0.0.1: 9090> the other 81 listens to another port.
3. In the httpd. conf file, let the file listen to port 81.
Add: Listen 9090.
4. Add a new domain name and IP address in the hosts file.
127.0.0.1 www.songjs2.com
5. Test: Enter www.songjs2.com: 9090 for access.
Summary:
At this time, another: 127.0.0.1 localhost is set.
The Virtual home directory is also configured, and the virtual home directory is configured as the home directory, and the previous home directory is overwritten and ignored.
You can use http: // localhost to access the home directory.
Http://www.songjs1.com: 9091 visit the first website
Http://www.songjs2.com: 9090 visit second website
Virtual Host Configuration