Newbie question Lucee on IIS not loading localhost but does load admin

OK. I’m glad you are making progress.

I think the redirects are because mod_cfml isn’t creating the webcontexts correctly for some reason. Maybe it’s because of the locahost name. I’m not sure. Maybe I never ran into that issue because I never needed to add localhost and expose it to IIS. I’ve never seen a good use case for that. I’d rather setup a custom domain in the etc/host file. I think that in your situation that localhost is causing a conflict. I’d try to deactivate mod_cfml and add these contexts manually just to make it possible. That is what I’d do with a “how to”:

First backup everything with a snapshot/image of your OS:

  1. Deactivate mod_cfml by doing the following steps:
    1.1 Open C:\path-to-lucee-installation\tomcat\conf\server.xml with a text editor
    1.2 Search for the string “mod_cfml.core”. You’ll find the valve tag. Set the whole valve tag as comment with <!-- <Valve className="mod_cfml.core"... > --> (Watch out to NOT to use the cfml triple dash comment <!--- This is a cfml comment that breaks tomcats start up ---> (cfml comments break tomcats startup)

  2. Set an alias localhost for host 127.0.0.1 like so (maybe this setting isn’t necessary, but I’m leaving this here as an option just in case):
    2.1 Open C:\path-to-lucee-installation\tomcat\conf\server.xml with a text editor
    2.2 Search for the string <Host name="127.0.0.1". You will find that host definition tag.
    2.3 Add the alias <Alias>localhost</Alias> just behind the host tag (but still inside the body of the host tag) like so:

<Host name="127.0.0.1"  appBase="webapps"  unpackWARs="true" autoDeploy="true">
<Alias>localhost</Alias>
...
</host>
  1. Create the webcontext configuration for that host manually like so:
    3.1 Create a directory (if it doesn’t already exist) named 127.0.0.1 at C:\path-to-lucee-installation\tomcat\conf\Catalina\. It has to be like so C:\path-to-lucee-installation\tomcat\conf\Catalina\127.0.0.1\.
    3.2 Inside that directory place a file (if it doesn’t already exist) named ROOT.xml (it will look like this C:\path-to-lucee-installation\tomcat\conf\Catalina\127.0.0.1\ROOT.xml) and add the following content to ROOT.xml with a text editor:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="C:\inetpub\wwwroot\">
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
 </Context>
  1. Restart Tomcat and give Tomcat some time to create all the contexts :

  2. Check the Contexts of Tomcat (at port 8888):
    5.1 Try opening http://127.0.0.1:8888
    5.2 Try opening http://localhost:8888

  3. Check if IIS is serving also the contexts (at port 80):
    6.1 Try opening http://127.0.0.1
    6.2 Try opening http://localhost

  4. Let us know about your progress.

1 Like