Xojo, formally Real Studio, is an amazing development tool. Not only does it allow you to easily and quickly develop professional quality, cross-platform, desktop applications but it also allows you to create stunning web applications without all the hassles involved with having to understand a whole stack of technologies like PHP, CSS, HTML5, etc.
Unfortunately, getting a server set up for deploying Xojo created web applications has been fairly challenging to some so I'm creating this guide that details the path I followed in getting my server ready. Note that this is the process I followed on Linux. Windows might be slightly different!
Also, I'm going to show you how to deploy your Xojo web apps as cgi scripts instead of the standalone version. I chose this method because I want to be able to use an SSL certificate with the application I built. Standalone apps cannot use SSL certs, only cgi based ones that are tied to Apache (or the web server of your choice; we'll use Apache).
Step 1: Have a functioning web server
It is beyond the scope of this tutorial to help you set up a functional web server. So I'm going to assume that you at least have been able to set up Apache to serve HTML content. It you need help getting to that point, see the Apache documentation for help.
Step 2: Installing and configuring FastCGI
Xojo web applications make use of a technology called FastCGI. FastCGI allows you to interface interactive programs (like the kind you write in Xojo) with a webserver. You can write these programs in a variety of languages like Xojo, C#, C++, Java, Perl, and even PHP. FastCGI just allows them to interact with the web server and provides a performance boost.
FastCGI does not come installed or configured with the standard Apache installation. So let's do that now. It's pretty simple:
1. Let's install the requirements. Note that I am using CentOS and the Yum package manager. If you are not using Yum, it should be fairly trivial to translate this command to whatever package manager your distro uses:
# yum install httpd-devel apr apr-devel libtool
2. Next, we need to download the mod_fastcgi source code. Again, pretty straightforward and simple. It assumes you have the wget program on your computer. Most Linux distros come with wget installed.
# cd /opt
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
3. Since the package came in as a tar archive, we next need to untar it using the tar command.
# tar -xvzf mod_fastcgi-current.tar.gz
4. Now, we need to install the module. When I wrote this tutorial, the latest version of mod_fastcgi as 2.4.6. Make sure that you substitute whatever version number the version your mod_fastcgi package is below.
# cd mod_fastcgi-2.4.6
# cp Makefile.AP2 Makefile
# make top_dir=/usr/lib/httpd
# make install top_dir=/usr/lib/httpd
5. Next, we need to tell Apache to load the module so that we can use it. To do this, you'll need to edit the /etc/httpd/conf/httpd.conf file in your favorite text editor.
Look for the section of the configuration file with a lot of LoadModule directives and append this line to the end of those entries:
LoadModule fastcgi_module modules/mod_fastcgi.so
That's all you need to do to the configuration file. No need to use 'AddHandler' or anything else.
6. Now, restart Apache
# /etc/inid.d/httpd restart
Note: some Linux systems no longer user init.d to manage services starting and stopping. If the above command doesn't work, find out what service management system your distro uses and use that.
7. Now, let's validate that the module is installed and loaded:
# grep -i "FastCGI" /var/log/httpd/error_log
If everything went right, you should see something like:
[Tues Jun 25 15:18:32 2013] [notice] FastCGI: process manager initialized (pid 8853)
If everything has gone right, we have our Apache properly configured and ready to serve up our Xojo apps. All we need to do are upload them to the right place and change a few permissions.
Step 3. Uploading your Xojo App
Uploading your Xojo app is just like uploading just about any other file. When you compile your app, Xojo creates several files and folders. You will need to upload all of those files and folders to your server.
Using the default Apache configuration, you should upload all of your Xojo web apps to the /var/www/cgi-bin directory. You can create subdirectories of that directory to contain each of your apps or you can change the Apache config to server your cgi scripts from anywhere. But, for this tutorial, we'll assume a default installation.
Step 4. Setting Permissions
In order for Xojo apps to run properly, you will need to set permissions on several files. You can usually do this through your FTP program. If you can't, or if you want to do it by hand, you can type the following commands:
# chmod 755 appname.cgi
# chmod 755 appname
# chmod 755 appname.config
Your app should now be ready to run and can be called from the browser like any other web app:
This guide is by no means the be all and end all of configuration guides for running Xojo apps. It's only what I did to get Xojo web apps running on my server. If you have trouble getting things running using this guide, feel free to email me at firstname.lastname@example.org or ask questions on the Xojo Mailing List. You'll find some amazingly helpful people there who can answer just about any question you have.
Did you like this post? Why not send me some Bitcoin!