阿帕奇 - 如何映射prefixes到不同的目录 [英] Apache - how to map prefixes to different directories
问题描述
是否有可能配置Apache,让不同的prefixes(而不是WWW)映射到文件系统中的不同的目录?例如...
Is it possible to configure Apache to allow different prefixes (instead of www) to map to different directories in the file system? For example...
我有我的网络服务器两种不同的环境:
I have two different environments on my webserver:
/home/me/test/web : Test Environment
/home/production/web : Production Environment
我想这些映射到以下网址:
I would like these to map to these urls:
test.mysite.com -> /home/me/test/web
prod.mysite.com -> /home/production/web
然而,没有什么我已经试过VirtualHosts工作有:
However, nothing I've tried with VirtualHosts has worked:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.mysite.com
** Some SetEnvs **
</VirtualHost>
<VirtualHost *:80>
ServerName prod.mysite.com
** Different SetEnvs **
</VirtualHost>
这引发以下错误:结果
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
时的这种配置甚至可以与Apache,还是我做错了什么?此外,一些澄清 - 简单重写了virtualhosts文件可能不适合任。它适用于直目录的东西,但然后像我可以一个虚拟主机部分中我不能使用任何SETENV指令。
Is this kind of configuration even possible with Apache, or am I doing something wrong? Also, some clarification - simple rewriting with a virtualhosts file probably won't fit either. It works for straight directory stuff, but then I can't use any SetEnv directives like I could within a VirtualHost section.
推荐答案
应:
不是
:
NameVirtualHost *:80
这篇关于阿帕奇 - 如何映射prefixes到不同的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!