View previous topic :: View next topic |
Author |
Message |
Miggi n00b


Joined: 20 Feb 2003 Posts: 24 Location: Switzerland
|
Posted: Sun May 02, 2004 8:38 pm Post subject: HOW-TO: Coldfusion MX under Tomcat |
|
|
I run here Coldfusion under Apache Tomcat and I like to share the know how to the great gentoo community, since I also used many other how-tos from this forum to setup other services.
I use it under Tomcat, because I was not able to use Coldfusion Server as a standalone server (several library problems). Coldfusion can also be setup with apache, it addes a kind of 404 handler which passes the request to the coldfusion server. But then you depend on some c libraries, which perhaps will change in the future. For security reasons I want to be able to update apache without waiting for macromedia to fix the module.
With the WAR Version (which can be build with the normal installer script since CF is implemented in pure java), you don't have such problems.
I basicaly followed the Documentation from http://www.macromedia.com/support/coldfusion/j2ee/phase2-tomcat-deploy.html. This made me no problems. The tricky stuff was to setup apache to handle virtual domains correctly.
I asume that you already installed the apache webserver, tomcat servlet engine and mod_jk2.
Step 1
Generate the war files with the installer and copy cfusion.war and rds.war to the webapps directory. Rename rds.war to CFIDE.war
Step 2
Create the file /etc/env.d/22cfusion and add the followin stuff to it:
Code: |
# Establish variables
CF_HOME="/opt/tomcat/webapps/cfusion"
CF_WEB_INF=$CF_HOME/WEB-INF
# Add binary file directories to the system path
CF_SHARED_LIB=$CF_WEB_INF/cfusion/lib
CF_SHARED_LIBS=$CF_SHARED_LIB:$CF_SHARED_LIB/_ilnx21/bin
LD_LIBRARY_PATH="$CF_SHARED_LIBS:$LD_LIBRARY_PATH"
# If using sandbox security,
# establish security JVM options (all on one line).
CF_SECURITY_JVM_OPTIONS="-Djava.security.manager \
-Djava.security.policy=$CF_WEB_INF/cfusion/lib/coldfusion.policy \
-Djava.security.auth.policy=$CF_WEB_INF/cfusion/lib/neo_jaas.policy"
# Establish graphics JVM options (all on one line).
# For JDK 1.4.1 and higher, specify
# com.gp.java2d.ExHeadlessGraphicsEnvironment instead of
# com.gp.java2d.ExGraphicsEnvironment.
CF_GRAPHICS_JVM_OPTIONS="-Xbootclasspath/a:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar:\
$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/i18n.jar:$CF_WEB_INF/cfusion/lib/webchartsJava2D.jar -Dcom.gp.java2d.ExHeadlessGraphicsEnvironment"
JAVA_OPTS="$CF_JVM_OPTIONS -Xms128m -Xmx256m -Dfile.encoding=iso8859-1"
|
Don't forget to set your right file encoding!
Step 3
Restart Tomcat and you should be able to log in to the coldfusion administrator. http://localhost:8080/CFIDE/administrator/index.cfm
Step 4
Install your cf apps under /opt/tomcat/webapps/cfusion
Step 5
edit /etc/apache2/conf/vhosts/vhosts.conf and put a global cf proxy configuration there. My machine dns local.machine I entered here is only a entry in the /etc/hosts and is not available from public.
Code: |
<Directory /opt/tomcat/webapps/cfusion/CFIDE>
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *>
DocumentRoot /var/www/localhost/htdocs
ServerName local.machine
#Internaly, this virtual host is used as coldfusion template proxy via mod_jk2 to tomcat
<Location /*.cfm>
JkUriSet worker ajp13:localhost:8009
</Location>
<IfModule mod_rewrite.c>
RewriteEngine On
#cfusion admin images
RewriteRule ^/cfusion/CFIDE/administrator/images(.*)$ http://local.machine:8080//cfusion/CFIDE/administrator/images$1 [P,L]
</IfModule>
</VirtualHost>
|
Step 6
Configure your virtual coldfusion domain(s):
Code: |
<Directory /opt/tomcat/webapps/cfusion/yoursite>
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *>
DocumentRoot /opt/tomcat/webapps/cfusion/yoursite
ServerName yoursite.domain
CustomLog /var/log/apache2/access_yoursite_log combined
<IfModule mod_rewrite.c>
RewriteEngine On
#proxy for cfm templates
RewriteRule ^/(.*).cfm$ http://local.machine/cfusion/yoursite/$1.cfm [P,L]
#proxy for directoryindex
RewriteRule ^.*/$ http://%{HTTP_HOST}%{REQUEST_FILENAME}index.cfm [P,L]
</IfModule>
</VirtualHost>
|
Restart apache and your coldfusion site should be available through apache!
Tip I also had Problems with with special characters retrived from mysql! The solution was to add
Code: |
seUnicode=true&characterEncoding=iso-8859-1
|
to the datasources connection string (available under the datasources advanced settings)
I wish you happy coding!
Miggi |
|
Back to top |
|
 |
NrG Tux's lil' helper

Joined: 09 Jun 2002 Posts: 83
|
Posted: Mon Oct 18, 2004 1:58 pm Post subject: |
|
|
Hi,
I followed your instructions and I now got CF running with Tomcat.
But I still got a few problems/questions, when i copy my website to the webapp dir and open it up in my browser it can only retrieve the CFM files.
All images and css files will not be shown and in my logs i get errors saying it is a permission problem. I don't know enough about tomcat and mod_jk2 to debug what im doing wrong, I guess I can only put CFM files into the appsdir? if not what would be the correct setting to make this work?
Also I have read about setting up mod_jk2 that i need to modify a file called "workers2.properties" in the apache conf dir, I guess this is not needed because Its already set with:
Code: |
<Location /*.cfm>
JkUriSet worker ajp13:localhost:8009
</Location>
|
Hope you (or somebody else) can help me.
nrg |
|
Back to top |
|
 |
NrG Tux's lil' helper

Joined: 09 Jun 2002 Posts: 83
|
Posted: Fri Feb 11, 2005 4:23 pm Post subject: |
|
|
The db connectionstring needs to be:
Code: | useUnicode=true&characterEncoding=iso-8859-1 |
You forgot to add the first u.
-nrg |
|
Back to top |
|
 |
p4m n00b

Joined: 10 Feb 2004 Posts: 14
|
Posted: Sat Feb 19, 2005 4:52 am Post subject: coldfusion 7 |
|
|
Is it the some for coldfusion 7?
In the next days I'll try to install first the standalone version and (if unsuccessfull) next the j2ee version
(actually I'm running coldfusion mx 6.1 under tomcat on gentoo since 1/2004)
If someone have tried to install coldfusion 7 on gentoo, please report the results soon |
|
Back to top |
|
 |
skermajo n00b

Joined: 07 Mar 2003 Posts: 26 Location: Brisbane, Australia
|
Posted: Sun May 22, 2005 10:52 pm Post subject: |
|
|
I successfully deployed Coldfusion MX 7 using this method  |
|
Back to top |
|
 |
laidback_01 n00b

Joined: 23 Jun 2005 Posts: 12
|
Posted: Mon Jun 27, 2005 2:33 pm Post subject: coldfusion7 |
|
|
I have installed CFMX 7 with no issues as well. It works like a charm on gentoo. There's a few hangups with the apache connector at first, but I did get around that. However, my next goal is to split the apache server phyisically to a seperate box from my coldfusion server. So I don't know how to do that - or if it's something so easy, I'm completely overlooking it.
If anyone has pointers on that, it'd be cool
THanks! |
|
Back to top |
|
 |
|