How to declare /var/www as Tomcat and Railo ROOT?
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开发者_JAVA百科/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 .cfm
s 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.
精彩评论