【问题标题】:CF file not found with Apache virtual hosts在 Apache 虚拟主机中找不到 CF 文件
【发布时间】:2013-06-01 01:00:58
【问题描述】:

我已将 Apache 2.2 配置为与 Coldfusion 9.2 一起运行,两者都在同一个 Centos 6.2 上。 Apache DocumentRoot 的一般配置是

DocumentRoot "/var/www/html"

到目前为止,Apache 将所有对 cfcs 和 cfms 的调用都交给了 Coldfusion。然后我创建了一个虚拟主机

<VirtualHost 192.168.123.207:80>
    ServerName myserver.server.private
    ServerAlias www.myserver.server.private
    ServerAlias webmail.myserver.server.private
    ServerAlias admin.myserver.server.private
    DocumentRoot /home/myserver/public_html
    ErrorLog /var/log/virtualmin/myserver.server.private_error_log
    CustomLog /var/log/virtualmin/myserver.server.private_access_log combined
    ScriptAlias /cgi-bin/ /home/myserver/cgi-bin/
    DirectoryIndex index.html index.htm index.php index.php4 index.php5
    <Directory /home/myserver/public_html>
        Options +Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
        allow from all
        AllowOverride All                     
        Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    </Directory>
    <Directory /home/myserver/cgi-bin>
        allow from all
        AllowOverride All     
        Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    </Directory>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} =webmail.myserver.server.private
    RewriteRule ^(.*) http://myserver.server.private:20000/ [R]
    RewriteCond %{HTTP_HOST} =admin.myserver.server.private
    RewriteRule ^(.*) http://myserver.server.private:10000/ [R]
</VirtualHost>

当我在http://myserver.server.private/hello.html 上打开一个 html 文件时,虚拟主机文档根目录 (/home/myserver/public_html) 中的正确文件会被提供。

虽然调用 cfm 失败。 Apache 正确传递请求,但随后出现 Coldfusion 错误消息:

File not found: /hello.cfm

似乎 Coldfusion 正在获取文件名,为其添加了错误的目录路径前缀,并且无法从磁盘加载它。

我扫描了所有 Coldfusion 文件以查找错误的文档根目录,但找不到任何内容。

编辑

事实证明,Coldfusion 在它自己的 webroot 目录中查找

/opt/coldfusion/wwwroot

我在那里放置了一个名称相同但内容不同的文件,并且该文件得到了服务,尽管有 a) 虚拟主机 b) 通用 DocumentRoot 设置为 /var/www/html。

【问题讨论】:

  • 我不熟悉你的设置,Apache 和 Centos,但即使在 JRun 和 Windows 上 ColdFusion 仍然会查看它自己的 webroot 目录并从该位置提供文件,即使存在同名文件在 Web 服务器上定义的 webroot。

标签: apache coldfusion virtualhost


【解决方案1】:

事实证明,coldfusion 用户(在我的例子中是 cfusion)需要在虚拟主机用户的组中。

usermod -a -G newuser cfusion

重新启动coldfusion后,一切正常。

【讨论】:

  • 感谢您回来并发布您的解决方案。
猜你喜欢
  • 2015-06-22
  • 2012-08-11
  • 2023-04-08
  • 2016-03-26
  • 2011-06-19
  • 2019-11-29
  • 1970-01-01
  • 2014-08-06
  • 2021-08-20
相关资源
最近更新 更多