PHP implements binding of one ip address (such as 127.0.0.1) and multiple domain names (virtual hosts). tutorial on 127.0.0.1 virtual host _ PHP

Source: Internet
Author: User
PHP binds an ip address (such as 127.0.0.1) and multiple domain names (virtual hosts) to a 127.0.0.1 virtual host. PHP binds an ip address (such as 127.0.0.1) and multiple domain names (virtual hosts). Solution 1 of 127.0.0.1 virtual hosts: differentiate virtual hosts through ports ① bind one ip address (for example, 127.0.0.1) and multiple domain names (virtual hosts) by binding one PHP, 127.0.0.1 virtual host

Solution 1: differentiate virtual hosts through ports

① Prepare for binding a site

1. first open your website (d:/myblog (stored in the myblog directory of drive d ))

2. configure the httpd. conf file (stored in the conf folder of the apache installation directory) and enable the httpd-vhosts.conf (remove the # sign before the second line ).

3. configure the httpd-vhosts.conf File (stored in the extra folder in the apache installation directory)

4. add the ing between ip address and domain name in the hosts file

C:/Windows/System32/drivers/etc/hosts

5. we recommend that you log out of DocumentRoot (the root directory of the document). in the httpd. conf file

6. test, enter "http://www.shunping1.com" in the browser to see the site home page

② Add a new domain name and bind it to the ip address:

1. develop a new website: d:/myblog2

2. configure the httpd. conf file (stored in the conf folder of the apache installation directory) and add a new VM.

3. make apache listen to port 81 in the httpd. conf file.

4. add a new domain name to the hosts file

5. test, enter http://www.shunping3.com: 80 in the browser (the port name must be added)

Solution 2: differentiate different domain names through ServerName

1. develop a new site d:/myblog2

2. in the httpd. conf file, enable apache to cancel listening to port 81 (add # in front or delete it directly)

3. add the configuration in the httpd-vhosts.conf File (note that the configuration here is different from solution 1)

4. other configurations remain unchanged

Binding of hosts (such as 127.0.0.1) and multiple domain names (virtual hosts), 127.0.0.1 virtual host Solution 1: differentiate different virtual hosts through ports ① bind one...

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.