【问题标题】:ColdFusion CommandBox - Forbidden messageColdFusion CommandBox - 禁止消息
【发布时间】:2021-05-15 15:45:40
【问题描述】:

我有一个关于 CommandBox 设置的问题。我使用最新版本的 ColdFusion,我的文件夹结构如下所示:

D:/CommandBox/wwwroot

wwwroot 文件夹中,我创建了index.cfm 文件。该文件只包含一行代码:

<cfoutput>#now()#</cfoutput>

一旦我在浏览器中运行它,这就是我使用的 url:

http://127.0.0.1:8080/

结果输出是我在浏览器中看到的错误信息:

Forbidden

如果我使用这个 url 代码将产生正确的输出:

http://127.0.0.1:8080/index.cfm

我想知道为什么index.cfm 必须包含在url 中?有没有办法将index.cfm 设置为默认登录页面?另外,我在我的根文件夹C:\Users\myusername\.CommandBox\server\D9F80673BC7799BE959B513656FE8F55-CommandBox\lucee-5.3.6.61\WEB-INF 文件web.xml 中找到了包含此代码:

<!-- default file to execute if directory is called with no file name, e.g. http://yourip.com/ !-->
  <welcome-file-list>
    <welcome-file>index.cfm</welcome-file>
    <welcome-file>index.lucee</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
  </welcome-file-list>

正如您在代码上方的评论中看到的,这应该是默认登录页面。如果有人知道此问题的原因和解决方案,请告诉我。谢谢。

【问题讨论】:

  • 您使用的是哪个网络服务器?需要设置默认文档供您的 Web 服务器处理。
  • 这能回答你的问题吗? Lucee Not Serving index.cfm By Default
  • @Miguel-F 这正是我想要的。问题是我的根文件夹中不存在index.cfm。我添加了index.cfm,但这并没有解决问题。当时 CommandBox 正在运行。在我停止 CommandBox 然后重新启动后,问题就解决了。如果我输入 127.0.0.1:8080,index.cfm 内容将显示在浏览器中。谢谢。
  • 你应该把它写下来作为解决方案,这样下一个人就会有答案。我还注意到它与现有的 Lucee 解决方案不同。
  • @espresso_coffee 很有趣。可能是一个值得在 Ortus 或 Slack 上发布的问题。传回的FORBIDDEN 错误与我对丢失文件的预期不同,但如果网络服务器不知道如何解释裸 url,则这是有道理的。不管怎样,很高兴你把它修好了。

标签: coldfusion lucee commandbox


【解决方案1】:

我为上述问题找到的解决方案是下一个。

 1. First step in this process is to create index.cfm file inside your
    root folder (CommandBox/wwwroot)
    
 2. Stop the CommandBox
    
 3. Start CommandBox again
    
 4. Entered this url in your browser: 127.0.0.1:8080 (you can replace 8080 with your port number)

【讨论】:

    【解决方案2】:

    根文件夹中必须有index.htmlindex.cfm 文件,请确保您没有丢失两者。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-26
      • 1970-01-01
      • 2021-03-21
      • 2018-12-02
      • 2019-02-28
      • 2021-05-11
      • 1970-01-01
      相关资源
      最近更新 更多