如何在Windows上为多个域名设置虚拟主机?
我将在我自己的测试项目中使用它。我需要设置三个项目,目前我正在为便携式Apache使用xampplite。
我还需要访问另一个项目,但它就像键入http://localhost/my-project/一样
我如何为它编写vhost配置?
发布于 2010-04-17 13:36:38
你需要做几个步骤才能完成这个任务。
c:\WINDOWS\system32\drivers\etc\下找到它。您应该已经从下面看到了第一行。它会照顾到你提到的其他项目。添加额外的请求到上述虚拟主机,路由回您自己的机器。
127.0.0.1本地主机127.0.0.1 foo-bar.com 127.0.0.1 abcdef.com 127.0.0.1 qwerty.comapache\conf\extra\httpd-vhosts.conf中添加以下内容,并在需要时更改端口(即,如果使用8080而不是端口80)。
DocumentRoot C:/xampplite/htdocs/foo-bar/ ServerName www.foo-bar.com DocumentRoot C:/xampplite/htdocs/abcdef/ ServerName www.abcdef.com DocumentRoot C:/xampplite/htdocs/qwerty/web/ ServerName www.qwerty.com{XAMPP-folder}\apache\conf\httpd.conf文件,并确保前面的#字符没有注释掉以下部分:
包括conf/extra/httpd-vhosts.conf..。你们现在应该都准备好了。如果您将另一个项目放在C:/xampplite/htdocs/my-project/下,则应该可以在您提到的URI中访问它。
发布于 2013-05-27 13:42:34
要使C:/xampp/htdocs/my-project/正常工作,我必须添加以下内容(默认?)VirtualHost到apache\conf\extra\httpd-vhosts.conf (在小鼠教程的步骤2中)。
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>发布于 2019-05-08 04:59:45
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 > https://stackoverflow.com/questions/2658173
复制相似问题