使用 VirtualHost ServerName 中的目录 [英] Using a directory in VirtualHost ServerName

查看:19
本文介绍了使用 VirtualHost ServerName 中的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用基于名称的虚拟主机配置,从相同的 IP 地址为大约 5 个不同的网站提供服务器,就像在 apache 文档中一样:

I'm currently using name-based virtual host configuration, to server about 5 different websites from the same IP address, just like in the apache documentation:

<VirtualHost *:80>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

是否有可能:

<VirtualHost *:80>
ServerName www.domain.tld/folderpath
DocumentRoot /www/software
</VirtualHost>

此文件夹中的网页使用的是不同的软件堆栈,我想将其很好地分开.上面的方法我试过了,没用.

The webpages in this folder are using a different software stack, and I'd like to keep it nicely separate. I tried the method above but it didn't work.

推荐答案

您的展示方式是不可能的 - VirtualHost 始终只是一个主机.但您可以使用 别名.

It's not possible the way you show - a VirtualHost is always just a host. But you could use an Alias.

<VirtualHost *:80>
ServerName www.domain.tld
DocumentRoot /www/domain

Alias /folderpath /www/software

</VirtualHost>

这篇关于使用 VirtualHost ServerName 中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆