Mapping issue @Lucee-5.3.7.48

The Jrun4 engine that CF9 used, was priority and could do some really cool things under the hood.

You are going to have to use different ports or different IP addresses under linux, and I may only be pointing out the obvious to you, as a redundancy as my caffeine has not kicked in.

any rate, You posted this

roto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5630/nginx: master  
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      400/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      677/sshd: /usr/sbin 
tcp6       0      0 :::8080                 :::*                    LISTEN      4888/java           
tcp6       0      0 :::22                   :::*                    LISTEN      677/sshd: /usr/sbin 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           400/systemd-resolve 

first thing I notice is that tomcat is not running on IPv4

just so I help you get to where you want to be technically
You want:
Website 1 /footytips/cfm port 80 (lucee tomcat)
Website 2 /footytips/www port 80 (nginx)

As in Linux port allocation is not dynamically β€œmagic” like it was in Jrun4 on IIS, what you need to do is bind either site to a second ip or port

in /etc/nginx/sites-enabled
if you do a ls -lt you will have

root@test1:/etc/nginx/sites-enabled# ls -lt
total 4
-rw-r--r-- 1 root root 447 Aug  4 16:20 footytips_com.conf
lrwxrwxrwx 1 root root  39 Aug  4 15:58 default.conf -> /etc/nginx/sites-available/default.conf

if you edit the default.conf you will have

server {
  listen 80 default_server;
   root /web/default/wwwroot/;
  index index.html;
}

change this to

server {
  listen www.footytips.com:80 default_server;
/footytips/www
  index index.html;
}

now change or or create footytips_cfm.conf


server {
  listen footytips.com:80;
  server_name footytips.com;
  root /footytips/cfm;

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
      # specific settings for files ending in suffixes .ico, .css, .js, gif, etc
  }

  location / {
      #proxy_pass  http://127.0.0.1:8080/;
      include     /etc/nginx/lucee-proxy.conf;
  }
  location ~ \.(cfm|cfml|cfc)$ {
     # proxy_pass  http://127.0.0.1:8080;
      include     /etc/nginx/lucee-proxy.conf;
  }
}

in the /etc/hosts I have 2 entries, which in DNS you can have cname pointed to either, or never create, really only matters for the context of getting this working vs which stack works better and when

127.0.0.1 www.footytips.com
127.0.0.1 footytips.com

you have in server-xml

    <Host name="footytips.com" appBase="webapps">
        <Context path="" docBase="/footytips/www" />
	<Alias>www.footytips.com</Alias> 

I would remove this and let nginx work as the proxy handler

@Terry_Whitney

Thanks for your time!!

First of all thanks tcp6 catch! which was happened with a new kernel so I switched to ipv4,

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2041/nginx: master
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1531/java
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 402/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 646/sshd: /usr/sbin
tcp6 0 0 :::22 :::* LISTEN 646/sshd: /usr/sbin
udp 0 0 127.0.0.53:53 0.0.0.0:* 402/systemd-resolve
udp 0 0 10.12.21.104:68 0.0.0.0:* 400/systemd-network

I tried what you suggested! Thats not worked at all! and found website should work without any NGINX conf files (:stuck_out_tongue: I was wondering why I made all changes each time and restart NGINX – there is no result no Wonder!!) Seems NGINX has an problem with proxying tomcat. I have to investigate it. Currently those website is working by default Lucee settings where I am facing same issues. BTW Thanks for your effort and time!

This have to be seriously looking into it.

Thanks Terry
Abhilash

1 Like

At work we have many production sites that run strictly tomcat without issues.

Ubuntu as popular as it is, is not our go to. I have found over the last 2 decades that upgrades and simple changes that are NIX standard simply work completely differently on Ubuntu.

The one thing you could try, and its if you ever have time. Rerun the install script as root. It more than likely will just work. :slight_smile:

Hi @Terry_Whitney,

Finally I got fixed the issue!

The problem is, for instance, if you want to run multiple website through Lucee, you have to add separate NGINX conf (That’s How mentioned by Pete
Assume that your website has both dynamic and static files and which dynamic files is run by Lucee (i.e. cfc, cfml, cfm, etc) so you should parse all request by tomcat through Nginx reverse proxy whereas static will handle by Nginx

In my case, assume, I have a two website, one is β€œexample.com” which pointing to the root directory is β€œ/website-1/www” and another one β€œadmin.example.com” which is pointing to β€œ/website-1/admin” like this and initially I did a new entry wherein Lucee admin panel β†’ Archives & Resources β†’ Mappings

first entry: Virtual as /admin β€”> Resource as /website-1/admin
then second entry like this
Virtual as β€œ/” ----> Resource as β€œ/website-1”

By this settings, should work only my β€œadmin.example.com” whereas the another one β€œexample.com”
doesn’t work at all!! because the problematic domain root directory is physically is β€œ/website-1/www” instead of Lucee mapping where does pointing β€œ/” to here β€œ/website-1” that’s where we need to do reverse proxying into tomcat properly then add a redirect rule to specific root directory.

So the solution is, I made NGINX as a reverse proxy then add a redirect rule in each conf files in NGINX

This is how I made in NGINX conf to got works,

/etc/nginx/sites-enabled/example.conf
server {
  listen          80;
  server_name     example.com;
  rewrite ^/(.*)$ /www/$1;
  location / {
    proxy_pass        http://127.0.0.1:8080;
   }
}

/etc/nginx/sites-enabled/admin.example.conf
server {
  listen          80;
  server_name     admin.example.com;
  rewrite ^/(.*)$ /admin/$1;  
  location / {
    proxy_pass        http://127.0.0.1:8080;
   }
}

Should be keep the same mapping settings in Lucee panel

Now both sites are working fine as expected!!!

Thanks @Terry_Whitney for your support.

Regards,
Abhilash S V

1 Like