Deploying Context

29 views
Skip to first unread message

swissmerlin

unread,
Jan 13, 2019, 5:50:11 PM1/13/19
to mod_cfml
Hello

I have setup a CentOS 7 Server with Tomcat and Lucee. I have choosen the manual way to setup a Lucee-Server to avoid problems which migth me happen with Plesk.

I have the problem, that the web-context of a all sites will be deployed  to the folder /opt/tomcat/webapps/root.

I have used some original configuration from a test system made by the all-in-one-installer for Lucee.

This configuration is bit different as you describe on your website. Instead of th AJP Conector the guys form Lucee are using the Tomcat Administration

IfModule mod_proxy.c>
   
ProxyPreserveHost On
   
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8080/$1$2
   
ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8080/$1$2
   
ProxyPassReverse / http://127.0.0.1:8080/
</IfModule>

LoadModule modcfml_module modules/
mod_cfml.so
CFMLHandlers ".cfm .cfc .cfml"
ModCFML_SharedKey "myKey"
LogHeaders false
LogHandlers false
LogAliases false
VDirHeader false



Before i go further, i like the be sure, which way is right.

Maybe if you an idea, where to look anyway, this would be great.

Btw, CFML-Code can be executed. Something is working already

Thanks and i hope that this group is still active

Cheers

Martin
 

Jordan Michaels

unread,
Jan 14, 2019, 3:32:40 PM1/14/19
to mod_cfml
Hi Martin,

Yep, still active. In the software world, no news is sometimes good news, because it means there aren't too many problems with your software!

Regarding AJP vs HTTP, you asked: "which way is right". The answer is that either way will do what you want it to. Both HTTP and AJP will proxy the connection between Apache and Tomcat. That said, if you CAN use AJP (meaning mod_proxy_ajp is available on your system), then that one will most accurately represent the proxy method that Adobe ColdFusion uses, so folks tend to prefer it when they switch between CFML engines. However, mod_proxy_ajp is not available on all systems, so you may be forced to use mod_proxy_http since it is more generally available.

Both methods have pro's and con's, but both ways work pretty well.

Examples of external posts on the topic:

Hope this helps!

-Jordan

swissmerlin

unread,
Jan 14, 2019, 6:02:55 PM1/14/19
to mod_cfml
Hi Jordan

Thanks for your answer!

I changed the configuration to AJP. I think, it works now (sort of):

- If i call a new website having CFML-Code, a simple <cfoutput> is good enough, the directory for the context in the catalina folder will be created and the path in the file root.xml is right. That is perfect.
- If i a call the Lucee Web  Administrator of a new website, the directory for the context in the catalina folder will not be created. It goes to the folder /opt/tomcat/webapps/ROOT/WEB-INF/Lucee instead.

If this is the rule of the game, then it is okay for me. But it is a bit odd.

Thanks

Martin

Jordan Michaels

unread,
Jan 14, 2019, 6:40:57 PM1/14/19
to mod cfml
Hi Martin,

With Lucee, you get two types of administrators. You get a Server administrator which gives you server-wide control, and you get a web administrator for each context (site). The server administrator will always come up from the same spot. The web administrators are delivered from each context's WEB-INF directory, and their site-specific settings are stored there as well. The default context ALSO has a web administrator, so don't get confused by default web administrator.

You can access each context's (site's) web aministrator from the site's specific URL:

http://[mysite.local]/lucee/admin/web.cfm

(be sure to replace [mysite.local] with your specific domain)

You CAN hit that url on port 8888, but the context needs to be created before you do, either by hitting the URL first and having mod_cfml create the context, or by setting the context to get created at Tomcat boot time by editing the Tomcat server.xml file.

Bottom line, you'll have one server administrator that's always delivered from the default context, and many web administrators for each site you have.

Hope this helps!

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Monday, 14 January, 2019 15:02:55
Subject: [mod_cfml] Re: Deploying Context

Hi Jordan

Thanks for your answer!

I changed the configuration to AJP. I think, it works now (sort of):

- If i call a *new website *having CFML-Code, a simple <cfoutput> is good
enough, the directory for the context in the catalina folder will be
created and the path in the file root.xml is right. That is perfect.
- If i a call the Lucee Web Administrator of a *new website, *the
directory for the context in the catalina folder will *not* be created. It
goes to the folder */opt/tomcat/webapps/ROOT/WEB-INF/Lucee* instead.

If this is the rule of the game, then it is okay for me. But it is a bit
odd.

Thanks

Martin

--
You received this message because you are subscribed to the Google Groups "mod_cfml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod_cfml+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

swissmerlin

unread,
Jan 15, 2019, 6:43:27 AM1/15/19
to mod_cfml
Hi Jordan


Thanks! I think this is important you wrote:

You CAN hit that url on port 8888, but the context needs to be created before you do, either by hitting the URL first and having mod_cfml create the context, or by setting the context to get created at Tomcat boot time by editing the Tomcat server.xml file.

Therefore it is normal, to hit the URL first to get the initial creation of the context. Or do not hit URL of the Lucee Web Administrator if the context was not created before. As i experienced, it would create a context in wrong folder.

Thanks!

Martin


swissmerlin

unread,
Jan 15, 2019, 8:14:22 AM1/15/19
to mod_cfml
I tried now to run a new installed web site. No context there, no Lucee admin.

After i hit the url, i got an exception "Page /index.cfm [/opt/tomcat/webapps/ROOT/index.cfm] not found" and a context at this location was created.

Something goes wrong, any idea?

Cheers

Martin

swissmerlin

unread,
Jan 15, 2019, 8:57:17 AM1/15/19
to mod_cfml
Btw,

What was the intention behind from the naming of the directories, like domainname-ch-domainname-ch-confl10?

Jordan Michaels

unread,
Jan 15, 2019, 12:55:46 PM1/15/19
to mod cfml
Hi Martin,

> As i experienced, it would create a context
> in wrong folder.

I don't think the context was actually created. In order to create a new context, the mod_cfml tomcat valve needs information that only Apache can provide to it using the Apache mod_cfml.so adapter. If you don't hit Apache, and just hit port 8888, mod_cfml will look at it, see that it doesn't have the info it needs, and ignore that request. That would mean you're actually hitting the default context, rather than a new context being created.

> After i hit the url, i got an exception "Page
> /index.cfm [/opt/tomcat/webapps/ROOT/index.cfm]
> not found" and a context at this location was
> created.
>
> Something goes wrong, any idea?

That's the directory of the default context. Can you give me more detail about the process you're taking? Since you're getting dropped into the default context, it means that either mod_cfml doesn't have what it needs to create the context. Both the mod_cfml Apache module and the mod_cfml Tomcat valve have debugging options, where you can turn on logging and mod_cfml will tell you exactly what it's doing and why. I would suggest you turn on logging for both the Apache and Tomcat pieces, and see what the logs tell you. Start with Apache, make sure things are getting found and passed properly, then review the Tomcat side, and see how the context is getting resolved.

> What was the intention behind from the naming
> of the directories, like
> domainname-ch-domainname-ch-confl10?

I don't recognize that directory name. Where are you seeing it?

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Tuesday, 15 January, 2019 03:43:27
Subject: [mod_cfml] Re: Deploying Context

Hi Jordan

Thanks! I think this is important you wrote:

You CAN hit that url on port 8888, but the context needs to be created
> before you do, either by hitting the URL first and having mod_cfml create
> the context, or by setting the context to get created at Tomcat boot time
> by editing the Tomcat server.xml file.
>

Therefore it is normal, to hit the URL *first* to get the initial creation
of the context. Or do not hit URL of the Lucee Web Administrator if the
context was not created before. As i experienced, it would create a context
in wrong folder.

Thanks!

Martin


swissmerlin

unread,
Jan 15, 2019, 1:24:07 PM1/15/19
to mod_cfml
Hello Jordan,

I will debug this after dinner. It isn't rocket science, i hope.
I made the configuration by following your documentation 1:1

To avoid problems with Plesk, i have a file called "z_lucee.conf" which will be loaded with the command "IncludeOptional conf.d/*.conf" in "httpd.conf".
Plesk may overwrite the file "httpd.conf" at any time.


> What was the intention behind from the naming
> of the directories, like
> domainname-ch-domainname-ch-
I don't recognize that directory name. Where are you seeing it

Underneath the folder /opt/tomcat/conf/catalina. Each of this directories holds the file "ROOT.xml" with the content for the web-inf stuff. Therefore mod_cfml generates them.
So, my private website has this folder "martinschaible-ch-martinschaible-ch-confl10"

Cheers!

swissmerlin

unread,
Jan 15, 2019, 2:07:47 PM1/15/19
to mod_cfml
Should i switch "Logheaders " to true for debuging and for mod_cfml valve i set "loggingenabled" to true.
Right?

Jordan Michaels

unread,
Jan 15, 2019, 3:42:11 PM1/15/19
to mod cfml
Ah. Okay. The catalina folders are based on the host header being passed by Apache.

See the source here (line 320):
https://github.com/viviotech/mod_cfml/blob/master/java/mod_cfml-valve/src/mod_cfml/core.java

So if the host headers you're passing Apache are funky, expect to see funky directories. Like the axiom goes: garbage in, garbage out. If you wish to avoid this, you an configure Apache so that it doesn't pass the mod_cfml config for the Apache default host. That way, if Apache gets requests for hosts that don't exist on your server, they won't get processed because they don't have the mod_cfml data.

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Tuesday, 15 January, 2019 10:24:07
Subject: [mod_cfml] Re: Deploying Context

Hello Jordan,

I will debug this after dinner. It isn't rocket science, i hope.
I made the configuration by following your documentation 1:1

To avoid problems with Plesk, i have a file called "z_lucee.conf" which
will be loaded with the command "IncludeOptional conf.d/*.conf" in
"httpd.conf".
Plesk may overwrite the file "httpd.conf" at any time.

> What was the intention behind from the naming
> > of the directories, like
> > domainname-ch-domainname-ch-

*I don't recognize that directory name. Where are you seeing it*
>

Underneath the folder* /opt/tomcat/conf/catalina*. Each of this directories
holds the file "ROOT.xml" with the content for the web-inf stuff. Therefore
mod_cfml generates them.
So, my private website has this folder
"martinschaible-ch-martinschaible-ch-confl10"

Cheers!

Jordan Michaels

unread,
Jan 15, 2019, 3:45:25 PM1/15/19
to mod cfml
I'd turn them all on for Apache:
https://viviotech.github.io/mod_cfml/docs-modcfml.html

Logheaders, LogHandlers, LogAliases, and vdirs if you use them - just to be thorough.

Logging should NOT be enabled for heavy-use systems, as it adds a significant burden to processing overhead - not to mention log file sizes!

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Tuesday, 15 January, 2019 11:07:47
Subject: [mod_cfml] Re: Deploying Context

swissmerlin

unread,
Jan 16, 2019, 6:48:58 AM1/16/19
to mod_cfml
Hi Jordan


Thank you for your help and time. i will start with the test today. You wrote:

So if the host headers you're passing Apache are funky, expect to see funky directories. Like the axiom goes: garbage in, garbage out. If you wish to avoid this, you an configure Apache so that it doesn't pass the mod_cfml config for the Apache default host. That way, if Apache gets requests for hosts that don't exist on your server, they won't get processed because they don't have the mod_cfml data.

That sound interesting. How can i configure Apache that t doesn't pass the mod_cfml config for the Apache default host?

Cheers

Martin

Jordan Michaels

unread,
Jan 16, 2019, 2:01:34 PM1/16/19
to mod cfml
Hi Martin,

There are lots of different ways you can go about doing it, but one way would be to disable Proxying for Apache's default site:

<Location /*>
ProxyPass "!"
</Location>

This would prevent anything hitting the default site in Apache from being proxied off to Tomcat. It's a simple solution and makes bad requests cost you almost nothing in server resources.

Hope this helps. =)

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Wednesday, 16 January, 2019 03:48:58
Subject: [mod_cfml] Re: Deploying Context

swissmerlin

unread,
Jan 29, 2019, 3:31:06 PM1/29/19
to mod_cfml
Hi Jordan

The universe had different plans for me. So i couln't continue with this task. Now i'm back.

Logheaders, LogHandlers, LogAliases

May i ask, where these log file are stored? Can't find them ;-(

Cheers

Jordan Michaels

unread,
Jan 29, 2019, 3:53:31 PM1/29/19
to mod cfml
Hi Martin,

Life happens.

> Logheaders, LogHandlers, LogAliases

These would be in your Apache logs. The location can vary based on your config, but if memory serves they're in your Apache error logs by default.

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "swissmerlin" <martin.sc...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Tuesday, 29 January, 2019 12:31:05
Subject: [mod_cfml] Re: Deploying Context

Martin Schaible

unread,
Feb 14, 2019, 11:45:36 AM2/14/19
to mod_...@googlegroups.com
Hi Jordan

How can i pass everything through mod_cfml?
PresideCMS needs that. With Windows using Boncode, i had to use a wildcard handler.

How can i accomplish this?

Thanks!

You received this message because you are subscribed to a topic in the Google Groups "mod_cfml" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mod_cfml/tI73iP0b9BE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mod_cfml+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Freundliche Grüsse / kind regards

Martin Schaible
Mittelfeldstrasse 27 | CH-8700 Küsnacht | Switzerland
Tel.: +41 44 391 30 00

E-Mail: mar...@martinschaible.ch
Internet:
www.martinschaible.ch

Brad Wood

unread,
Feb 14, 2019, 11:47:16 AM2/14/19
to mod_...@googlegroups.com
Are you sure Preside doesn't just require URL rewrites to turn things like site.com/foo into site.com/index.cfm/foo 
With rewrites, you don't need to do anything to the connector since they all look like cfm files. 

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Jordan Michaels

unread,
Feb 14, 2019, 12:42:18 PM2/14/19
to mod cfml
Hi Martin,

To answer your original question, I assume you're asking how to do that on Linux/Apache, since you got it working how you want it on Windows/IIS.

Just add your mod_cfml config to your "root" apache config file - httpd.conf (centos) or apache2.conf (ubuntu) and that should apply it to all sites.

Hope this helps!

--
Kind regards,
Jordan Michaels
Vivio Technologies

----- Original Message -----
From: "Brad Wood" <bdw...@gmail.com>
To: "mod cfml" <mod_...@googlegroups.com>
Sent: Thursday, 14 February, 2019 08:47:07
Subject: Re: [mod_cfml] Re: Deploying Context

Are you sure Preside doesn't just require URL rewrites to turn things like
site.com/foo into site.com/index.cfm/foo
With rewrites, you don't need to do anything to the connector since they
all look like cfm files.

Thanks!

~Brad

*Developer Advocate*
*Ortus Solutions, Corp *

Martin Schaible

unread,
Feb 14, 2019, 12:57:03 PM2/14/19
to mod_...@googlegroups.com
I'm sorry that i mixed up two different issues.

It is really the case, that we need not only to pass *.cfm or *.cfc to Tomcat. We need to pass everything, even images to Tomcat. That is the way PresideCMS works, i was told.
As i wrote, i had to add a wildcard handler in the Windows world using BonCode. Now i need to do the same in the Linux world.

I think that the proxy needs some changes, e.g. passing everything to tomcat.

Thanks!

Jordan Michaels

unread,
Feb 14, 2019, 2:04:44 PM2/14/19
to mod cfml
Hi Martin,

That would be a simple proxy command. Without testing it, the config would look something like this:

<IfModule mod_proxy.c>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8888/
ProxyPassReverse / http://127.0.0.1:8888/
</IfModule>

You're probably not the only one to ever want to do this though, so if that doesn't work there are probably more elaborate & tested configs on Google.
Reply all
Reply to author
Forward
0 new messages