Hell YES. This ^&(%^989&^%*(% Tomcat is now working for me like a
bleeding pig. Hell YES!!!! 12 hours of making this shit working. I am
dying :F
I haven't found anywhere instruction so I put this in here
Assumption data:
- site folder is f:/usr/htdocs/cfpages/site
- site folder is accessible by the Apache
- our site is
http://localFirstCFWheels
- no mod_jk no mod URLFilter or how this shit is called
- pure apache rewrite rules
- Apache Tomcat 6.0.26 Server
- Apache 2.2.13 (and later)
- Railo 3.1.2.001
- Apache Tomcat is configured to listen on 8100 port
1. You need to install tomcat and railo (railo as a module - i don't
know how to call it. :D) good instruction in it is in here
http://corfield.org/entry/Railo_on_Tomcat__multiweb (just don't make
this part with hosts - we will make this in here)
2. You need to install apache with mod_rewrite and mod_proxy and
mod_proxy - there are a lot of tutorials about it just find in google
3. When you've got everything working then stop both servers (Tomcat
and Apache)
4. Go to the web.xml file located in Tomcat_Install_Path/conf end open
it in editor
5. Find this place with servlet-mapping (you were configuring this in
the 1. )
6. Add
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/index.cfm/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/rewrite.cfm/*</url-pattern>
</servlet-mapping>
After
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>*.cfc</url-pattern>
</servlet-mapping>
this will rule Tomcat to serve content from rewrited URL. Save web.xml
and close
7. Go to the server.xml file located in Tomcat_Install_Path/conf end
open it in editor. Scroll down to the end of the file and find
something like this
<Host name="localhost"
Scroll down to the last added host and add onethor one:
<Host name="localFirstCFWheels" appBase="webapps">
<Context path="" docBase="f:/usr/htdocs/cfpages/site"/>
<Alias>www.localFirstCFWheels</Alias>
</Host>
this will rule Tomcat to launch new host. Save server.xml and close
8. (on windows / xampp any system) Open ApacheInstallPath/conf/
httpd.conf and uncomment (or add at the end of the file)
Include conf/extra/httpd-vhosts.conf
9. (on windows / xampp any system) Open ApacheInstallPath/conf/extra/
httpd-vhosts.conf and create new Virtual Host (If you are new to
VirtualHosts on Apache first find the tutorial on it)
a/ declaration
<VirtualHost *:80>
b/ ServerName and AliasName as usually in VirtualHost
ServerName localFirstCFWheels
ServerAlias localFirstCFWheels
DocumentRoot "f:/usr/htdocs/cfpages/site"
DirectoryIndex index.cfm
c/ secure your directory from browsing the files
<Directory "f:/usr/htdocs/cfpages/site/">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
d/ Turn on rewrite engine for that host
RewriteEngine On
e/ Forbid open proxying
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>
f/ Protect proxying
ProxyRequests Off
g/ Give Apache a chance to rewrite url's
ProxyPass /
http://localFirstCFWheels:8100/
ProxyPassReverse /
http://localFirstCFWheels:8100/
h/ Pass the oryginal host not the proxied
ProxyPreserveHost On
i/ use standard rewrite condition for CFWheels
RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|
cfformgateway|railo-context|files|images|javascripts|miscellaneous|
stylesheets|robots.txt|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
j/ and the last but not the least make rewrite rule
RewriteRule "^/(.*)"
http://localFirstCFWheels:8100/rewrite.cfm/$1
[P,QSA,L]
10. Go to your cfwheels site, open the settings.cfm file add
<cfset set(urlRewriting="On")>
save and exit
11. Start Tomcat, start apache
12. GoTo
http://localFirstCFWheels and enjoy your webapp hosted on the
Tomcat with full url rewrite
Why have I tested this and written this instruction? The anserw is
very simple. I still haven't found the option to install Railo on
GlassFish as a web module. And the Resin....
Sorry for theese words but Resin is just a piece of shit good for
developing but not for production. Maybe If you've got one site or
something. I've got a site with over 60.000 unique visitors per day.
On the same machine I've got the Apache with PHP and IIS with .NET and
I've got GlassFish which I must have. I have put there Resin and
started it. And that was the major mistake in my life. Resin has took
at the beggining over 300 MB of memory, and when I've started every
each appliaction written in CF it took over 1GB of RAM! An Tomcat?
Tomcat right now is making everything in about 150 MB of RAM.
And the most importand information is that Tomcat is much much fatser
then Resin. Reload of application took almost the same time as other
operations.
As for now I am shure that I will be trying to find way to install
Railo on GlassFish, but I have found a wonderfull alternative and a
wonderfull production server for my ColdFusion apps.
regards
jmail