Virtual Host Configuration

Source: Internet
Author: User

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

Related Article

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.