Apache 别名虚拟主机
我有两个应用程序在同一台服务器上运行,我希望从 url 中的子路径(即)提供一个应用程序:
- foo.com -> /var/www/foo
- foo.com/bar -> /var/www/bar
我正在尝试创建别名但不起作用:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName foo.com
DocumentRoot /webapps/foo/current/public
<Directory /webapps/foo/current/public>
AllowOverride all
Options -MultiViews
</Directory>
RailsEnv staging
Alias /blog /webapps/blog/current
<Directory /webapps/blog/current>
allow from all
Options +Indexes
</Directory>
你知道为什么这不起作用吗?
我也尝试了 serverpath 指令,但没有成功。
你知道如何实现这一目标吗?
提前致谢。
I have two applications running in the same server and I would like to have one served from subpath in the url (i.e):
- foo.com -> /var/www/foo
- foo.com/bar -> /var/www/bar
I'm trying to do an alias but is not working:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName foo.com
DocumentRoot /webapps/foo/current/public
<Directory /webapps/foo/current/public>
AllowOverride all
Options -MultiViews
</Directory>
RailsEnv staging
Alias /blog /webapps/blog/current
<Directory /webapps/blog/current>
allow from all
Options +Indexes
</Directory>
Do you know why this is not working?
I also tried serverpath directive without any success.
Do you know how to achieve this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
AliasMatch
而不是Alias
:或者,根据您的情况:
Use
AliasMatch
instead ofAlias
:Or, in your case:
您是否考虑过为您的其他应用程序使用另一个单独的子域,例如
bar.foo.com
?设置方法如下:
Have you considered using another separate subdomain, like
bar.foo.com
for your other application?Here's how you'd set that up: