配置Apache虚拟主机(视窗) [英] setup apache virtualhost (windows)
问题描述
如何设置虚拟Windows上的多个域名?
我会用我自己的测试项目。我有3个项目,我需要设置,并在我使用Xampplite文件为便携阿帕奇的时刻。
How to setup virtualhost for multiple domain name on windows ? I will use it for my own test projects. I have 3 projects that I need to setup and at the moment I'm using xampplite for the portable apache.
- www.foo-bar.com - >直接到c:\\ Xampplite文件\\ htdocs中\\ foo的酒吧\\
- www.abcdef.com - > DIRECTO到c:\\ Xampplite文件\\ htdocs中\\ ABCDEF \\
- www.qwerty.com - >直接到c:\\ Xampplite文件\\ htdocs中\\键盘\\网络\\
我还需要另一个项目访问,但它就像打字
的http://本地主机/我的项目/
I also need to access on another project but it just like typing http://localhost/my-project/
如何写虚拟主机的配置是什么?
how to write the vhost configuration for that ?
推荐答案
您需要做的,以使这项工作几个步骤。
You need to do several steps in order to make this work.
1)更新主机
文件在Windows XP中,你可以找到它在 C:\\ WINDOWS \\ SYSTEM32 \\驱动程序\\等\\
。你应该已经看到的第一线从下方,它需要你提到的其他项目的服务。 - 添加其他的人做出路由回你自己的机器所提到的虚拟主机的任何请求。
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)在更新Apache配置虚拟主机的文件。在您的XAMPP文件夹,添加以下的apache \\的conf \\额外\\的httpd-vhosts.conf
如果需要更改端口(即,如果您使用8080而不是80端口)。
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)进行快速配置检查。打开 {XAMPP文件夹} \\ apache的\\的conf \\ httpd.conf文件
您的文件,并确保该下面的部分不是由preceeding注释掉#
人物:
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 preceeding #
character:
Include conf/extra/httpd-vhosts.conf
4)重新启动XAMPP。
...你应该是所有设置了。您的其他项目应该是访问的URI你所提到的,如果你只是把它放在 C:/ Xampplite文件/ htdocs中/我的项目/
这篇关于配置Apache虚拟主机(视窗)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!