如何声明/ var / www作为Tomcat和Railo ROOT? [英] How to declare /var/www as Tomcat and Railo ROOT?

查看:568
本文介绍了如何声明/ var / www作为Tomcat和Railo ROOT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让Apache的 / var / www 成为我的railo CMS的根目录?我把railo.war放入 / var / lib / tomcat6 / webapps ,并将以下内容放入我的 /etc/tomcat6/server.xml

 < Host name =localhostappBase =webapps
unpackWARs = trueautoDeploy =true
xmlValidation =falsexmlNamespaceAware =false>
< Context path =docBase =/ var / www/>

现在,当我把一个index.cfm放入/ var / www并转到 http:// localhost 我收到以下错误

  Railo [3.2.2.000] (java.io.IOException)
消息没有这样的文件或目录
原因java.io.IOException
Java Stacktrace
没有这样的文件或目录
在java.io .UnixFileSystem.createFileExclusively(Native Method): - 2
at java.io.File.createNewFile(File.java:883):883
at railo.commons.io.res.type.file.FileResource .getOutputStream(FileResource.java:220):220
at railo.commons.io.res.type.file.FileResource.getOutputStream(FileResource.java:209):209
at railo.commons.io .IOUtil.copy(IOUtil.java:135):135

很明显,Railo不接受 .cfm 不在webapps文件夹之下?



帮助非常感谢!

解决方案

您已正确设置您的Tomcat主机的上下文和文档基础(Web根) / var / www 与此:

 < Context path =docBase =/ var / www/&但是,这告诉Tomcat Web应用程序位于 / var / 

,但您尚未将WAR内容部署到该位置。你把你的railo.war放在 / var / lib / tomcat6 / webapps 下面,这告诉我你可能使用标准的Ubuntu信息库安装 tomcat6 包。如果这个假设是正确的,那么你应该能够在 http:// localhost:8080 / railo / 默认浏览到你的Railo WAR。



你想做的是提取你的railo.war文件,并把它的内容放在 / var / www 下面(即 WEB-INF 文件夹)。下面是一些命令,将允许您使用< Host> 正确部署 / var / www / c>配置。我假设你在Ubuntu上,安装了 tomcat6 包,并且在你的主目录中有一个Railo WAR文件为〜/ railo。 war 。 Ubuntu tomcat6 包的Tomcat作为 tomcat6 用户运行,因此您可能希望给文件/目录所有权

 #将目录更改为Railo WAR内容的目标位置:
cd / var / www

#提取Railo WAR内容:
sudo jar xvf〜/ railo.war

#提供Tomcat用户文件所有权:
sudo chown -R tomcat6 / var / www /

#重新启动Tomcat服务以确保root应用程序被选中:
sudo service tomcat6 restart

您现在应该可以浏览到 index.cfm http:// localhost:8080 / 下的Railo WAR,现在位于 /var/www/index.cfm



请记住,这里没有讨论将Apache HTTPD Web服务器连接到Railo / Tomcat的讨论。您可能需要阅读此处或< a href =http://corfield.org/blog/post.cfm/Railo_for_Dummies_Part_IV_Appendix>此处的Apache到Tomcat代理选项。 Railo Wiki还提供了此安装指南部分。


I wanted to have Apache's /var/www to be the root for my railo CMS? I put the railo.war into /var/lib/tomcat6/webapps and put the following into my /etc/tomcat6/server.xml:

<Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/var/www"/>

Now when I put an index.cfm into /var/www and go to http://localhost I get the following error

Railo [3.2.2.000] - Error (java.io.IOException)
Message No such file or directory
Cause   java.io.IOException
Java Stacktrace 
No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method):-2
at java.io.File.createNewFile(File.java:883):883
at railo.commons.io.res.type.file.FileResource.getOutputStream(FileResource.java:220):220
at railo.commons.io.res.type.file.FileResource.getOutputStream(FileResource.java:209):209
at railo.commons.io.IOUtil.copy(IOUtil.java:135):135

So obviously Railo doesn't accept that .cfms are outside the webapps folder?

Help is very much appreciated!

解决方案

You have properly set your Tomcat Host's Context for root context and a document base (Web root) of /var/www with this:

<Context path="" docBase="/var/www" />

However, this is telling Tomcat that a Web application lives under /var/www but you have not deployed a WAR's contents to that location. You placed your railo.war under /var/lib/tomcat6/webapps, which tells me that you've probably used the standard Ubuntu repository install of the tomcat6 package. If this assumption is correct, then you should be able to browse to your Railo WAR at http://localhost:8080/railo/ by default.

What you want to do is extract your railo.war file and place its contents beneath /var/www (namely, the WEB-INF folder from the WAR). Below are some commands that would allow you to properly deploy a Railo WAR under /var/www/ using the <Host> configuration you have specified in your question. I'll assume you're on Ubuntu, with the tomcat6 package installed, and have a Railo WAR file in your home directory as ~/railo.war. The Ubuntu tomcat6 package has Tomcat running as the tomcat6 user, so you'll probably want to give file/directory ownership to that user, otherwise Railo would not be able to write any files to disk.

# Change directory to destination for Railo WAR contents:
cd /var/www

# Extract Railo WAR contents:
sudo jar xvf ~/railo.war

# Give Tomcat user file ownership:
sudo chown -R tomcat6 /var/www/

# Restart Tomcat service to ensure root app is picked up:
sudo service tomcat6 restart

You should now be able to browse to the index.cfm file included with the Railo WAR at http://localhost:8080/, which is now located at /var/www/index.cfm.

Keep in mind that there is nothing discussed here concerning connecting your Apache HTTPD Web server to Railo/Tomcat. You might want to read here or here for Apache-to-Tomcat proxy options. The Railo Wiki also has this Installation Guides section.

这篇关于如何声明/ var / www作为Tomcat和Railo ROOT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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