XAMPP虚拟主机 - 总是加载的htdocs [英] xampp virtual host - always loading htdocs
问题描述
我想创建在我的本地(XAMPP)的虚拟主机。想尽组合在那里,但我总是装,而不是特定文件夹的htdocs
下面是主机
文件:
127.0.0.1本地主机
:: 1本地主机
127.0.0.1 devsnappy
下面是的httpd-vhosts.conf
:
了NameVirtualHost *:80
<虚拟主机*:80>
的DocumentRoot E:/ XAMPP / htdocs中/瞬间/公
服务器名devsnappy
<目录E:/ XAMPP / htdocs中/活泼/公众>
选择指数包括了FollowSymLinks ExecCGI
所有的AllowOverride
为了允许,拒绝
所有允许
< /目录>
< /虚拟主机>
有什么建议?
下面是一个引导以虚拟主机添加到XAMPP
看来你错过hosts文件什么的。
举例来说,假设你有其他网站的ClientB。你想补充127.0.0.1在hosts文件和C clientB.local>:\\ XAMPP \\ apache的\\的conf \\额外\\的httpd-vhosts.conf是这样的:
块引用>*了NameVirtualHost
<虚拟主机* GT;
的DocumentRootC:\\ XAMPP \\ htdocs中
服务器名本地主机
< /虚拟主机>
<虚拟主机* GT;
的DocumentRootC:\\ Documents和Settings \\我\\我的文档\\ clientA上\\网站
服务器名clientA.local
<目录C:\\ Documents和Settings \\我\\我的文档\\ clientA上\\网站>
为了允许,拒绝
所有允许
< /目录>
< /虚拟主机>
<虚拟主机* GT;
的DocumentRootC:\\ Documents和Settings \\我\\我的文档\\ clientB \\网站
服务器名clientB.local
<目录C:\\ Documents和Settings \\我\\我的文档\\ clientB \\网站>
为了允许,拒绝
所有允许
< /目录>
< /虚拟主机>和重新启动的httpd
I am trying to create a virtual host on my localhost (XAMPP). Tried every combination out there, but I always get htdocs loaded instead of the specific folder
Here is the
hosts
file:127.0.0.1 localhost ::1 localhost 127.0.0.1 devsnappy
Here is
httpd-vhosts.conf
:NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot E:/xampp/htdocs/snappy/public ServerName devsnappy <Directory "E:/xampp/htdocs/snappy/public"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Any suggestions?
解决方案Here is a guide to add vhost to xampp
Seems that you miss something with the hosts file.
For example, say you had another Web site for ClientB. You’d add 127.0.0.1 clientB.local >in the hosts file and the C:\xampp\apache\conf\extra\httpd-vhosts.conf would look like this:
NameVirtualHost * <VirtualHost *> DocumentRoot "C:\xampp\htdocs" ServerName localhost </VirtualHost> <VirtualHost *> DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website" ServerName clientA.local <Directory "C:\Documents and Settings\Me\My Documents\clientA\website"> Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *> DocumentRoot "C:\Documents and Settings\Me\My Documents\clientB\website" ServerName clientB.local <Directory "C:\Documents and Settings\Me\My Documents\clientB\website"> Order allow,deny Allow from all </Directory> </VirtualHost>
And restart httpd
这篇关于XAMPP虚拟主机 - 总是加载的htdocs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!