foundeo / ubuntu-nginx-lucee

Script for standing up a Lucee server using nginx and Tomcat on Ubuntu
Apache License 2.0
86 stars 47 forks source link

Is there a simple step-by-step tutorial #28

Closed kwfricke closed 6 years ago

kwfricke commented 6 years ago

I have tried to get this going several times. I have even hired system's admins who have experience with nginx and tomcat (but not lucee) and none of us can get this going. I can't believe that there are not some tutorials on the web. Do you happen to have guidance for what to do after we install everything?

The server.xml file doesn't seem to be connecting to the nginx vhost at all. I can server up an index.html file fine but the index.cfm file does not work.

Any help out there?

pfreitag commented 6 years ago

Hi @kwfricke

The main thing that is needed to connect a website in nginx to tomcat/lucee is adding

include lucee.conf;

See: https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/etc/nginx/sites-available/example.com.conf#L10

For docs there really is just this: https://github.com/foundeo/ubuntu-nginx-lucee/wiki and the main README: https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/README.md

kwfricke commented 6 years ago

Thanks for responding. I have been trying for about 5 days to get this working. I'm not sure if it is my version of Ubuntu or, most likely, that I am just an idiot. I have decided to go back to Apache.

On Wed, Dec 27, 2017 10:34 AM, Pete Freitag notifications@github.com wrote: Hi @kwfricke

The main thing that is needed to connect a website in nginx to tomcat/lucee is adding

include lucee.conf;

See: https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/etc/nginx/sites-available/example.com.conf#L10

For docs there really is just this: https://github.com/foundeo/ubuntu-nginx-lucee/wiki and the main README: https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/README.md

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.


Kevin FrickeLone Star Media Mobile: (512) 626-0528 Email:kevin@lonestarmedia.com

kwfricke commented 6 years ago

I am trying again. Here is what I am doing.

First, I am installing this on a new droplet from Digital Ocean for Ubuntu 16.04.3. After completing the installation, I go to the conf for the default site and add the proxy conf so that my nginx conf file looks like below:

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

However, when I try to visit the site it spins for a long while then times out.

http://159.203.101.162/index.cfm

504 Gateway Time-out

I'm sure it is something easy but for the life of me I can't figure it out.

Any ideas?

kwfricke commented 6 years ago

Here is what I see in the nginx logs:

Connection timed out -- http://127.0.0.1:8080/index.cfm

kwfricke commented 6 years ago

21149#21149: *5 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.69.69.102, server: , request: "GET /index.cfm HTT$ $fm HTTP/1.1", upstream: "http://127.0.0.1:8080/index.cfm", host: "159.203.101.162"

(to be exact)

kwfricke commented 6 years ago

finally...i got a successful page at http://159.203.101.162:8080/ but when i try to go to http://159.203.101.162/index.cfm I get the following error:

HTTP Status 500 - java.io.FileNotFoundException: /opt/lucee/config/server/lucee-server/patches/5.2.4.37.lco (No such file or directory)

kwfricke commented 6 years ago

is there a version of ubuntu that you recommend with this?

pfreitag commented 6 years ago

Hi @kwfricke - these scripts are designed to work with Ubuntu 16.04 LTS, I just setup a server last week with it successfully - so I'm not sure what is going wrong. I am running this script later today on another server so I'll let you know if I run into anything.

I'm not sure why the 5.2.4.37.lco file is not found... that is part of Lucee internally and gets created by Lucee automatically when it starts up. One possibility might be if Lucee did not have permission to extract the file there... Can you double check that the tomcat8 user has write permission to the folder (ls -l /opt/lucee/config/server/lucee-server/patches/). The script changes the ownership of the /opt/lucee folder to tomcat8 recursively here:

https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/scripts/300-tomcat.sh#L60-L61

kwfricke commented 6 years ago

FYI - I just tried with the latest version of Ubuntu and it seems to have worked! I am still testing but so far so good

pfreitag commented 6 years ago

Great - let me know if you have any further issues.

kwfricke commented 6 years ago

Here is what is strange. I was able to setup a server using DO and get everything going. I tried the same thing again with a smaller server and now I am getting that same error as before:

Message java.io.FileNotFoundException: /opt/lucee/config/server/lucee-server/patches/5.2.4.37.lco (No such file or directory)

The steps I took were the exact same.

pfreitag commented 6 years ago

Hmm that is strange... I wonder if during startup Lucee ran out of memory (ram) by default the script is set to use 512m of heap, which is pretty small but has worked for small footprint servers in the past. You might check the log files for tomcat and lucee for any clues.

What is the difference in specs between the servers (eg RAM)?

kwfricke commented 6 years ago

The original server was 2GB ram and the new one was only 512MB ram. i am going to try one with 1GB ram...

pfreitag commented 6 years ago

Yeah if you are using 512MB of ram on the server, then you need to decrease the max heap size to something much smaller probably 256mb of ram

With the latest script you could do that by running this before running the command before running install:

export JVM_MAX_HEAP_SIZE=256m ./install.sh

If you want to change the heap size after you have run install.sh then you can do it like this:

export JVM_MAX_HEAP_SIZE=256m sed -i "s/-Xmx128m/-Xmx$JVM_MAX_HEAP_SIZE/g" /etc/default/tomcat8

kwfricke commented 6 years ago

Update -- not sure why but the minimum DO droplet that works is the 2 CPU / 2 GB server. I am trying that one again now...

JasPanesar commented 6 years ago

@kwfricke Thanks for that tidbit - I have noticed the install process seems to require a bit more resourcing during installation.

I have run into similar issues when setting up Lucee/Mura on a VM - Once setup, java & the lucee admin can be tuned down can run on 512 or 1 GB of RAM (something I have done with Linodes before). However in the Lucee Admin, the request timeout has to be increased to approx 5 minutes, especially to let Mura's first time bits run.

I'm going to try this script out with a 2 GB DO next time and can report back.

A sincere thanks to both you and @pfreitag's support to spend some time on this - I have ended up manually installing Lucee a few more times than I wanted.

t3custom commented 6 years ago

I have attempted to run this script on an Azure VM running Ubuntu 16.04.3 using Oracle JVM 1.8_162. It appears to install just fine, but when its done nothing works. The VM has 4GB of memory. Has anyone had any luck getting this script going on Azure?

pfreitag commented 6 years ago

@t3custom when you say nothing works - can you elaborate? Did you setup a site in nginx that did include lucee.conf, like this: https://github.com/foundeo/ubuntu-nginx-lucee/blob/master/etc/nginx/sites-available/example.com.conf

The default nginx virtual host does not include lucee.conf on purpose, so all those bots that iterate over ip addresses don't even hit lucee. Are you able to connect to tomcat on port 8080? Is anything showing up in the logs?