Railo CFML

How to Set Up Railo CFML Engine with Tomcat and Apache on Ubuntu 24.04

Welcome to the Greenhost.cloud blog! Today, we’ll walk you through a comprehensive guide on setting up the Railo CFML engine with Apache Tomcat and Apache HTTP Server on Ubuntu 24.04. Whether you’re developing CFML applications or hosting legacy projects, this step-by-step tutorial will help you get your environment up and running smoothly.


Prerequisites

Before we begin, ensure you have:

  • A fresh Ubuntu 24.04 server with sudo privileges
  • An active internet connection
  • Basic familiarity with terminal commands

Step 1: Update Your System

First, update your package list and upgrade existing packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Java Development Kit (JDK)

Tomcat requires Java to run. Install OpenJDK 11:

sudo apt install openjdk-11-jdk -y

Verify the installation:

java -version

Step 3: Install Apache Tomcat

Download the latest Tomcat 9 (or newer if available). For Ubuntu 24.04, Tomcat 10+ is also supported, but for compatibility, we’ll proceed with Tomcat 9.

cd /opt
sudo wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.78/bin/apache-tomcat-9.0.78.tar.gz

Extract and set up permissions:

sudo tar -xzf apache-tomcat-9.0.78.tar.gz
sudo mv apache-tomcat-9.0.78 tomcat
sudo chown -R $USER:$USER /opt/tomcat

Create a systemd service for Tomcat:

sudo nano /etc/systemd/system/tomcat.service

Add the following content:

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

User=your_username
Group=your_username

Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

Restart=on-failure

[Install]
WantedBy=multi-user.target

Replace your_username with your actual username. Save and close the file.

Enable and start Tomcat:

sudo systemctl daemon-reload
sudo systemctl enable --now tomcat

Verify it’s running:

sudo systemctl status tomcat

Step 4: Install Railo CFML Engine

Railo is a lightweight CFML engine compatible with Tomcat. Download the Railo WAR file:

cd /opt
sudo wget https://downloads.railo.org/railo-3.3.2.004.war -O railo.war

Deploy Railo in Tomcat:

sudo mv railo.war /opt/tomcat/webapps/

Tomcat will automatically deploy the WAR file. Wait a few moments, then verify by accessing:

http://your_server_ip:8080/railo/

You should see the Railo admin interface.


Step 5: Set Up Apache HTTP Server and Reverse Proxy

Install Apache:

sudo apt install apache2 -y

Enable necessary modules:

sudo a2enmod proxy proxy_http
sudo systemctl restart apache2

Configure a virtual host to proxy requests to Tomcat:

sudo nano /etc/apache2/sites-available/railo.conf

Add the following configuration:

<VirtualHost *:80>
    ServerName your_domain_or_ip

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    ErrorLog ${APACHE_LOG_DIR}/railo_error.log
    CustomLog ${APACHE_LOG_DIR}/railo_access.log combined
</VirtualHost>

Replace your_domain_or_ip with your actual domain or server IP.

Enable the site and restart Apache:

sudo a2ensite railo.conf
sudo systemctl reload apache2

Now, visiting http://your_server_ip/railo/ should display the Railo interface through Apache.


Step 6: Final Checks and Security

  • Ensure your firewall allows HTTP/HTTPS traffic.
  • Consider setting up SSL certificates with Let’s Encrypt for secure access.
  • Tweak Tomcat and Railo configurations as needed for performance and security.

Conclusion

Congratulations! You’ve successfully set up the Railo CFML engine with Tomcat and Apache on Ubuntu 24.04. This environment provides a robust platform for developing and hosting CFML applications.

If you encounter any issues or have questions, feel free to reach out in the comments below or contact us at Greenhost.cloud. Stay tuned for more tutorials on cloud hosting and server management!


The Greenhost.cloud Team