AW: how to setup lucee4.5/centos7/tomcat8/jdk8/nginx/samba

Sorry i forgot one thing:

Please esexute those 2 command to make the samba share ( \yourhostname\wwwroot<file://yourhostname/wwwroot> ) writeable:

chmod -R 0755 /home/wwwroot
chown -R nobody:nobody /home/wwwroot

michaelVon: Michael Heel
Gesendet: Donnerstag, 24. März 2016 15:24
An: ‘’
Betreff: how to setup lucee4.5/centos7/tomcat8/jdk8/nginx/samba

I thought it might be a good idea to post a complete install-howto for lucee4.5/centos7/tomcat8/jdk8/nginx/samba.
I hope it helps some people to get started with lucee AND maybe get a better idea how each of the components work.
At the end of this howto you will have a 2,5GB small virtual machine ready for developing.

we dont go for securtiy here its a “quick” howto to get a clean lucee installation. lets call it a dev-machine. for security rtfm :slight_smile:

  1. Installing minimal CentOS 7
  • Download CentOS 7 Minimal-ISO (

  • create an VM or install on a physical machine with at least 4GB RAM 1-4 cores (i took 4 cores and this must be set later in nginx.conf (worker_processes 4;)

  • CentOS 7 comes with an step-by-step-installer, some notes about the installer:
    a) there is only one language in the IT-business - stick to english
    b) set Date/timezone correctly, enable network time
    c) set your Keyboard language
    d) leave the software selection untouched
    e) check the partition layout as most of your harddisk will be in /home else (webroot in home would be ok too for a dev-server)
    f) configure ntwork, set eth0 ON, set hostname, configure IPv4 manual with an IP, netmask gateway, dns and search domain if wanted/needed
    g) begin installation and while you wait set the root user password :slight_smile:

  1. Installing the Software Stack (Samba, nginx, tomcat8, JDK8, Lucee)
  • ssh into your new server (f.e. with winscp in combination with putty, putty can be integrated in winscp, if you are a windows guy)
  • yum install -y epel-release
  • yum install -y unzip samba samba-client samba-common htop nginx nano
  • yum update -y
  • systemctl enable nginx
  • systemctl enable smb.service
  • systemctl enable nmb.service
  • mkdir /home/wwwroot
  • rm -rf /opt/tomcat/webapps/docs
  • rm -rf /opt/tomcat/webapps/examples
  • rm -rf /opt/tomcat/webapps/manager
  • rm -rf /opt/tomcat/webapps/host-manager
  • mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
  • nano /etc/samba/smb.conf
    paste these lines into smb.conf and change the netbios name to your hostname

workgroup = WORKGROUP
server string = Samba Server %v
netbios name = yourhostname
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
path = /home/wwwroot
browsable =yes
writable = yes
guest ok = yes
read only = no

Systemd unit file for tomcat

Description=Apache Tomcat Web Application Container



ExecStop=/bin/kill -15 $MAINPID



            e) systemctl daemon-reload
            f) systemctl enable tomcat
            g) nano /opt/tomcat/conf/context.xml
<!--   (remove this line)
<Manager pathname="" />
            -->                          (remove this line)

            h) nano /opt/tomcat/bin/

                           paste this into (optimized for CONTENS CMS Version 4 and JDK8) or set your own JAVA-OPTS here:

#! /bin/sh



export CATALINA_OPTS="$CATALINA_OPTS -XX:+ParallelRefProcEnabled"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxGCPauseMillis=200"
export CATALINA_OPTS="$CATALINA_OPTS -XX:InitiatingHeapOccupancyPercent=70"
export CATALINA_OPTS="$CATALINA_OPTS -XX:G1ReservePercent=15"
export CATALINA_OPTS="$CATALINA_OPTS -XX:ParallelGCThreads=20"
export CATALINA_OPTS="$CATALINA_OPTS -XX:+AggressiveOpts"
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/tomcat/lucee/lucee-inst.jar"

Check for application specific parameters at startup

if [ -r “$CATALINA_BASE/bin/” ]; then

echo “Using CATALINA_OPTS:”
for arg in $CATALINA_OPTS
echo ">> " $arg
echo “”

echo “Using JAVA_OPTS:”
for arg in $JAVA_OPTS
echo ">> " $arg
echo “_______________________________________________”
echo “”

  • download and install lucee 4.5 (
    we will use just the jars-download:
    copy it to your server or download it directly on the server into /opt or wherever

              a) mkdir /opt/tomcat/lucee
              b) unzip /opt/ -d /opt/tomcat/lucee
              c) rm -f /opt/
  • configure tomcat (server.xml, web.xml and

              a) nano /opt/tomcat/conf/server.xml (change the hostname to whatever tomcat should listen to and change the docbase to your webroot)
              paste these 3 lines nearly at the end before </Engine>
            b) nano /opt/tomcat/conf/web.xml
            paste the following lines at line 24 (its not so important where exactly)

<!-- ===================================================================== -->
<!-- Lucee CFML Servlet - this is the main Lucee servlet                   -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <description>CFML runtime Engine</description>
        <description>Lucee Web Directory</description>
        <description>Directory where Lucee server root is stored</description>

<!-- ===================================================================== -->
<!-- Lucee REST Servlet - handles Lucee's RESTful web services             -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet id="RESTServlet">
    <description>Lucee Servlet for RESTful services</description>

            c) nano /opt/tomcat/conf/
            add this to the common.loader= line ,"/opt/tomcat/lucee/","/opt/tomcat/lucee/*.jar"

            the complete line should look like this now:


  • configure nginx (nginx.conf and the yourserver.conf)

              a) nano /etc/nginx/nginx.conf
              just replace the content of nginx.conf with these lines

For more information on configuration, see:

* Official English Documentation:

* Official Russian Documentation:

user root;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /run/;

events {
worker_connections 1024;
multi_accept on;
use epoll;

http {
log_format main '$remote_addr - $remote_user [$time_local] “$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘"$http_user_agent" “$http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See
# for more information.
include /etc/nginx/conf.d/*.conf;

b) nano /etc/nginx/conf.d/yourserver.conf
paste these lines into the new file and save it and please change the hostname hmkay ?

server {
    listen       80;
    server_name  srv-lucee;
    root         /home/wwwroot;
    autoindex  on;
    access_log  /var/log/nginx/host.access.log  main;

## Size Limits
            client_body_buffer_size     128K;
            client_header_buffer_size   128K;
            client_max_body_size          1M;
            large_client_header_buffers 1 1k;

            ## Timeouts
            client_body_timeout   60;
            client_header_timeout 60;
            #expires              24h;
            keepalive_timeout     60 60;

            ## Proxy Timeouts
            proxy_connect_timeout              1200;
            proxy_send_timeout                    1200;
            proxy_read_timeout                     1200;
            send_timeout                                  1200;

            ## General Options
            ignore_invalid_headers  on;
            keepalive_requests      100;
            recursive_error_pages   on;
            sendfile                off;
            server_name_in_redirect off;
            server_tokens           off;

            ## TCP options
            tcp_nodelay on;
            tcp_nopush  on;

            ## Compression
            gzip              on;
            gzip_buffers      16 8k;
            gzip_comp_level   6;
            gzip_http_version 1.0;
            gzip_min_length   0;
            gzip_types        text/plain text/css image/x-icon application/x-perl application/x-httpd-cgi;
            gzip_vary         on;

location / {
           root   /home/wwwroot;
    index  index.cfm index.html index.htm;
                autoindex on;
            # Main Lucee proxy handler
                           location ~ \.(cfm|cfc)(.*)$ {
                                           proxy_redirect off;
                                           proxy_set_header Host $host;
                                           proxy_set_header X-Forwarded-Host $host;
                                           proxy_set_header X-Forwarded-Server $host;
                                           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                           proxy_set_header X-Real-IP $remote_addr;

   error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
  1. are you still with me ?
    congrats you made it so far and you didnt scream for an installer. now you know what components are needed to run lucee and you’ve set it up yourself. thats a good base.
    please reboot your server now.

type “reboot”

if everything was done correctly (i hope you added the hostname to your hostfile) you should now be able to login to lucee server for the first time


dont forget to give the lucee server and the lucee web a password.

you can also access your webroot now: \yourhostname\wwwroot<file://yourhostname/wwwroot>

if you run into problems please let me know.

some command you might need in the future:

service tomcat start/stop/status
service nginx start/stop/status

log-file locations:


michael heel
CONTENS Software GmbH