Set Up Lucee So Domain Name Goes To Subdirectory Under Root?

Hopefully a simple question for the experts here:

I have an AWS EC2 instance running Amazon Linux, MySQL, PHP, and Lucee 5.
Everything is running awesomely!

The domain name I have installed, let’s say “www.example.com”, goes to
Lucee’s root at “/opt/lucee/tomcat/webapps/ROOT” when I browse to it. That
works fine.

How would I set this up so that when I browse to “www.example.com”, it goes
to the subdirectory in Lucee’s root “/opt/lucee/tomcat/webapps/ROOT/
example”?

Thank you in advance!

I’m trying to work through this, and found documentation right in the
Tomcat “server.xml” file comments about how to add a section.
Here’s what I added to that file:

  •    <Host name="example.com" appBase="webapps"*
    
  •            unpackWARs="true" autoDeploy="true">*
    
  •            <Context path="" 
    

docBase="/opt/lucee/tomcat/webapps/ROOT/example" />*

  •            <Alias>www.example.com</Alias>*
    
  •    </Host>*
    

However, then when I browse to “www.example.com” (or just “example.com”), I
get the following error message:

Lucee 5.0.0.254 Error (application)
Message there is no cache or datasource with name [coldfusion-www] defined.
Java Stacktrace lucee.runtime.exp.ApplicationException: there is no cache
or datasource with name [coldfusion-www] defined.
at
lucee.runtime.type.scope.ScopeContext.getClientScope(ScopeContext.java:244)
at
lucee.runtime.type.scope.ScopeContext.getClientScopeEL(ScopeContext.java:260)
at lucee.runtime.PageContextImpl.clientScopeEL(PageContextImpl.java:1358)
at
lucee.runtime.type.scope.UndefinedImpl.reinitialize(UndefinedImpl.java:597)
at
lucee.runtime.PageContextImpl.setApplicationContext(PageContextImpl.java:2791)
at
lucee.runtime.listener.ModernAppListener.initApplicationContext(ModernAppListener.java:442)
at
lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:116)
at
lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2250)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2242)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2210)
at
lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:848)
at
lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Timestamp 10/23/16 12:10:10 AM UTC

I think there is something else I need to do besides adding the
section, but I don’t know what.

I know the MySQL database “coldfusion-www” is set up and working, mapped in
the Lucee administrator, and “Storage” is turned ON (“Allow to use this
datasource as client/session storage.”)

If I take the section out of the “server.xml” file, I have to browse
to “example.com/example” to see my site. Then I can see the site with no
“coldfusion-www” error, so I know the database is working.

Without the section, if I browse to “www.example.com” (or just
example.com”, I see the Lucee home page in the ROOT directory.

I’m wondering:

  • Is this a root mapping issue that when I set up the section to
    point to the “/opt/lucee/tomcat/webapps/ROOT/example” directory?

  • Is it a problem with something inside the “WEB-INF” directory because
    it is in a different directory relative to where Tomcat things root is?

I’m stumped!

I’m just trying to get “www.example.com” to go to the
“/opt/lucee/tomcat/webapps/ROOT/example” subdirectory. That’s all!

Can anyone please help?

Thanks!On Friday, October 21, 2016 at 6:35:13 PM UTC-7, Jim Newton wrote:

Hopefully a simple question for the experts here:

I have an AWS EC2 instance running Amazon Linux, MySQL, PHP, and Lucee 5.
Everything is running awesomely!

The domain name I have installed, let’s say “www.example.com”, goes to
Lucee’s root at “/opt/lucee/tomcat/webapps/ROOT” when I browse to it. That
works fine.

How would I set this up so that when I browse to “www.example.com”, it
goes to the subdirectory in Lucee’s root “/opt/lucee/tomcat/webapps/ROOT/
example”?

Thank you in advance!