Coldfusion:多个 local.domains 用于测试。映射“/”每个的根

发布于 2025-01-04 14:43:10 字数 899 浏览 0 评论 0原文

我在 Apache 上运行 CF9 Developer,在我的计算机上为多个域运行测试服务器,这些域的站点最终远程托管。一切正常,但我目前只能在其中使用“/”根映射。这是我的本地域:

  • local.domain1.com
  • local.domain2.com
  • 等...

这里有物理路径:

  • C:\www\domain1.com\
  • C:\www\domain2.com\

在 CF 管理员中,我具有以下 Active ColdFusion 映射:(逻辑路径:“/” - 目录路径:“C:\www.domain1.com\”)。这适用于 local.domain1.com。但是,我在CF Administrator中只能添加一个“/”逻辑路径。

换句话说,域 1 将成功加载 cfinclude template="/anyrootfolder/anyfile.cfm",因为它的根已映射。如果我尝试使用 cfinclude template="/anyrootfolder/anyfile.cfm",域 2、3 等将会失败,因为“/”根未映射。

有什么建议如何在同一服务器上映射多个“/”吗?

编辑:

正如我在 Al 的回答下的评论中所引用的,我发现每当我在 cfinclude 上使用绝对路径时,所有域都会从domain1的文件结构中获取。在CF管理员中,我删除了带有逻辑路径“/”和目录路径“C:\www\domain1.com\”的活动CF映射,这似乎成功了。我不确定为什么它在那里(也许是默认 CF 设置过程的一部分?)。无论如何,将其删除到任一测试站点后我都没有看到任何错误,并且我的其他域现在按预期工作(可能是因为我已经在 Apache 的配置下设置了文档根?[参见 RobG 的答案。])谢谢大家!

I'm running CF9 Developer on Apache to run a testing server on my computer for multiple domains whose sites are ultimately hosted remotely. Everything works, but I can currently only use the "/" root mapping on one. Here are my local domains:

  • local.domain1.com
  • local.domain2.com
  • etc...

And here are there physical paths:

  • C:\www\domain1.com\
  • C:\www\domain2.com\

In CF Administrator, I have the following Active ColdFusion Mapping: (Logical Path: "/" - Directory Path: "C:\www.domain1.com\"). This works for local.domain1.com. However, I can only add one "/" logical path in CF Administrator.

In other words, domain 1 will sucesfully load cfinclude template="/anyrootfolder/anyfile.cfm" because it's root is mapped. Domains 2, 3, etc, will fail if I try to use cfinclude template="/anyrootfolder/anyfile.cfm" because the "/" root is not mapped.

Any suggestions how I can map multiple "/" on the same server?

EDIT:

As referenced in my comments under Al's answer, I discovered that all domains were grabbing from domain1's file structure whenever I used an absolute path on a cfinclude. In CF Administrator, I deleted the Active CF Mapping with Logical Path "/" and Directory Path "C:\www\domain1.com\", and this seemed to do the trick. I'm not sure why that was in there (maybe as part of the default CF setup process?). Anyway, I don't see any errors as a result of deleting it to either test site, and my other domains now work as expected (probably because I already had the document roots set up under Apache's config? [See RobG's answer.]) Thanks all!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧竹 2025-01-11 14:43:10

我认为你根本不需要这个映射。在我的本地计算机上,我会将 local.domainX.com 条目放入 Hosts 文件 (C:\windows\system32\drivers\etc\host) 中,然后在 Apache 中为每个条目配置一个虚拟目录。

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:\www\domain1.com"
ServerName local.domain1.com
</VirtualHost>

如果您需要有关 Apache 配置的更多信息,请告诉我。

I don't think you need this mapping at all. On my local machine, I would put your local.domainX.com entries in your Hosts file (C:\windows\system32\drivers\etc\host), and then configure a virtual directory in Apache for each one.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:\www\domain1.com"
ServerName local.domain1.com
</VirtualHost>

Let me know if you need more info on the Apache config.

温柔嚣张 2025-01-11 14:43:10

不能对 / 使用应用程序级映射吗?

在应用程序.cfc中

<cfset THIS.mappings["/"]="C:\www\domain2.com\">

Can you not use application-level mappings for /?

In Application.cfc

<cfset THIS.mappings["/"]="C:\www\domain2.com\">
泼猴你往哪里跑 2025-01-11 14:43:10

很久以前,我不仅处理测试机器上的多个站点,而且还处理同一生产服务器上的多个站点,对此我感到很烦恼。我最终的解决方案是为每个站点创建一个基本的三字符“前缀”映射。

因此,典型的 cfinclude 是...


请注意,这还允许您引用可能保存在其他站点之一的文件、图像和其他资源。

I death with this a long time ago dealing not only with multiple sites on a test machine but with multiple sites on the same production server. My eventual solution was to create a base three character "prefix" mapping for each site.

As such, typical cfincludes would be...

<cfinclude template="/tqs/home.cfm">
<cfinclude template="/bqo/home.cfm">

Note that this also allows you to reference files, images, and other resources that might be saved on one of your other sites.

<cfcontent file="#expandpath("/bqo/images/pixel.gif")#" type="...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文