Apache Configure virtual domain name

Source: Internet
Author: User

When doing PHP local debugging, generally have to hit the localhost/, if your project hierarchy is more, then your URL address will be very long.

Can we use a short domain name instead of a long list of useless characters?

Then someone might ask, what if I don't have a domain name? In fact, in the development phase, we can build a virtual domain name locally, the following steps:

(1) Open Apache httpd-vhosts.conf (Wampserver For example, directory under D:\wamp\bin\apache\apache2.4.23\conf\extra)

(2) Enter below the file

<virtualhost *:80>//80 for Apache port number DocumentRoot "e:/study/demo/project1/"//quotation mark fill in the project address ServerName zyf.cn Fill in your virtual domain </VirtualHost>

This step will allow Apache to recognize our virtual domain name, below we will also let our browser to know our virtual domain name

(3) Open c:\Windows\system32\drivers\etc The following Hosts file (Notepad open), enter 127.0.0.1 zyf.cn at the bottom of the file

      

Done!

Apache Configure virtual domain name

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.