使用虚拟主机服务器名称目录 [英] Using a directory in VirtualHost ServerName

查看:159
本文介绍了使用虚拟主机服务器名称目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的基于域名的虚拟主机配置,服务器在5个​​不同的网站来自同一IP地址,就像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>

难道possbile有这样的:

Is it possbile to have something like:

<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.

推荐答案

这是不可能告诉你的方式 - 一个虚拟主机永远只是一台主机。但href=\"http://httpd.apache.org/docs/2.0/mod/mod_alias.html\">别名你可以使用一个

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>

这篇关于使用虚拟主机服务器名称目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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