setup apache virtualhost (windows)

亡梦爱人 提交于 2019-11-27 16:59:51
MicE

You need to do several steps in order to make this work.


1.) Update the hosts file. On Windows XP, you can find it under c:\WINDOWS\system32\drivers\etc\. You should already see the first line from below, it takes care of your mentioned other project. - add the additional ones to make any requests to the mentioned virtual hosts routed back to your own machine.

127.0.0.1       localhost
127.0.0.1       foo-bar.com
127.0.0.1       abcdef.com
127.0.0.1       qwerty.com


2.) Update the vhosts file in Apache configuration. Under your XAMPP folder, add the following to apache\conf\extra\httpd-vhosts.conf and if needed change the ports (i.e. if you use 8080 instead of port 80).

<VirtualHost *:80>
    DocumentRoot C:/xampplite/htdocs/foo-bar/
    ServerName www.foo-bar.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot C:/xampplite/htdocs/abcdef/
    ServerName www.abcdef.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot C:/xampplite/htdocs/qwerty/web/
    ServerName www.qwerty.com
</VirtualHost>


3.) Do a quick configuration check. Open {XAMPP-folder}\apache\conf\httpd.conf your file and make sure that the following part is not commented out by a preceding # character:

Include conf/extra/httpd-vhosts.conf


4.) Restart XAMPP.

... and you should be all setup now. Your other project should be accessible at the URI you mentioned if you just put it under C:/xampplite/htdocs/my-project/.

To get C:/xampp/htdocs/my-project/ working I had to add the following (default?) VirtualHost to apache\conf\extra\httpd-vhosts.conf (in step 2 of MicE tutorial).

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>
Anand computer gyaan
127.0.0.5  abcd.com

<  VirtualHost 127.0.0.5 >

    ServerName abcd.com

    DocumentRoot "C:\xampp\htdocs\laravel\public" 

    <Directory "C:\xampp\htdocs\laravel\public">

        DirectoryIndex index.php

        AllowOverride All

        Order allow, deny

        Allow from all

    </Directory>

< / VirtualHost > 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!