Apache-将网址路径视为虚拟主机 [英] Apache - treat url path as virtual host

查看:94
本文介绍了Apache-将网址路径视为虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是我只有一个域名,需要在该域名上运行3个不同的产品(其中2个基于PHP,1个python).因此,我需要做的是将url中的路径视为不同的虚拟主机.即:

The problem is that I have only one domain name on which 3 different products need to be run (2 of them PHP based, 1 python). So what I need to do is to treat path in url as different virtual host; ie:

www.domain.com/first_url/
www.domain.com/second_url/
www.domain.com/third_url/

第一到第三位将充当单独的虚拟主机.

Where first to third will act as separate virtual hosts.

有什么线索怎么做?

推荐答案

您可能想使用apache-config指令来做一些事情,因为您正在寻求虚拟主机解决方案.如@cweiske所述,Apache只能将virtualHosts作为实际域使用.

You probably want to do something with the apache-config directives, since you're asking for a virtualhost solution. Apache can only work with virtualHosts as actual domains, as @cweiske explained.

在这种情况下,解决方案是在正在使用的子目录中使用.htaccess文件,或在当前(虚拟)主机配置中设置<Directory "/web/root/subdir">..</Directory>块.

The solution in this case would be to either use a .htaccess file in the sub-directories you're working in, or to set up a <Directory "/web/root/subdir">..</Directory> block within your current (virtual-)host config.

如果您本身想将它们作为VirtualHosts('app1.domain.org')运行,也可以选择将它们托管在不同的子域上

You could also choose to host them on different sub-domains if you per-se want to run them as VirtualHosts ('app1.domain.org')

这篇关于Apache-将网址路径视为虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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