Configuring virtual hosts under Windows Apache

Source: Internet
Author: User

Configure multiple virtual hosts because there are multiple laravel projects that need to be configured with the root directory under public

Method One: Add a port number

    • The first step: Enter the Apache directory apache24\conf find httpd.conf file, under Listen 80 plus Listen Bayi

  

    • Step Two: Enter the httpd.conf file's sibling directory Apache24\conf\extra find the httpd-vhosts.conf file, at the end of the file add

<virtualhost *:bayi>"E:\PHP\exam\public" Change the path to your own   </ Virtualhost>

    • Step three: After you restart Apache, you can access localhost:81 directly in the browser.

Method Two: Add host name

    • First step: Go to directory C:\Windows\System32\drivers\etc find the hosts file, add 127.0.0.1 XXXX (name to own) at the end of the file

  

    • Step Two: Enter the Apache directory Apache24\conf\extra find the httpd-vhosts.conf file, at the end of the file add
<virtualhost *:>    ServerName exam.cn  name changed to own    documentroot E:             /  Php/exam/public     Path to its own  <directory  "e:/php">          +indexes +includes +followsymlinks +multiviews        allowoverride all        Require Local     </Directory></VirtualHost>
    • Step three: After you restart Apache, you can access exam.cn directly in the browser.

Configuring virtual hosts under Windows Apache

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.