Installation

Index

  1. Download Ophal
  2. Server configuration
  3. Dependencies
  4. Installation wizard
  5. Send your feedback

1. Download Ophal

There are two options:

a) Download from ophal.org/download

Just do it and extract contents of downloaded file to your web server’s public directory, just make sure that index.cgi is accessible at http://example.com/index.cgi.

b) Clone the main Ophal repository

$ mkdir /path/to/mysite
$ cd /path/to/mysite
$ git init
$ git remote add ophal git://github.com/ophal/core.git
$ git fetch ophal
$ git merge ophal/master

2. Server configuration

The easy way and the manual way:

a) The easy way

Docker will install everything you need to run Ophal for you. First get Docker installed and running, then run the following command:

$ docker run --name ophal -v /var/www/ophal/:/var/www/ -tid develcuy/dev-ophal

Command above will create a container called “ophal” with your local code (supposedly located at /var/www/ophal) attached to container’s internal path /var/www.

Docker is just awesome but it requires some learning to take full advantage of it. Please do accordingly.

Now you can jump to section Installation wizard.

b) The manual way

This instructions assume that you installed Ophal at /var/www/ophal.

Ophal can run on native Nginx’s HttpLuaModule or as a humble CGI script on Apache, Lighttpd and others that support CGI and URL rewriting. FastCGI support can be implemented with a FastCGI wrapper on Apache, Nginx, Lighttpd and several other web servers.

Apache

Enable mod_rewrite and mod_cgi, then use following configuration for reference:

Sub-directory

Alias /lua /var/www/ophal/
<Directory "/var/www/ophal">
    AllowOverride All
    Options Indexes FollowSymLinks MultiViews +ExecCGI
    Order allow,deny
    Allow from all
</Directory>

Virtualhost

<VirtualHost *:80>
    ServerAlias ophal

    DocumentRoot /var/www/ophal
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/ophal/>
            Options Indexes FollowSymLinks MultiViews +ExecCGI
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ErrorLog /var/log/apache2/ophal-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog /var/log/apache2/ophal-access.log combined

</VirtualHost>

Lighttpd

Install mod_magnet and use the file lighttpd.ophal.lua to configure your server. Also, enable module cgi. Then use following configuration for reference:

$HTTP["host"] =~ ".+\.ophal" {
  evhost.path-pattern = "/var/www/%_/"
  index-file.names = ("index.cgi")
  cgi.assign = ( ".cgi" => "/usr/local/bin/luajit" )
  magnet.attract-physical-path-to = ("/etc/lighttpd/lighttpd.ophal.lua")
}

Notice that configuration above assumes that you are using “luajit”.

Nginx

Install HttpLuaModule and use the file nginx.ophal.conf to configure your server. Make sure to set ‘server_name’ and ‘root’ correctly.

If you are on a Debian based distro, make sure to have the package nginx-extras installed.

3. Dependencies

What versions of Lua are supported?

At the moment, Ophal supports Lua 5.1 only.

LuaJIT or Lua?

Ophal uses Lua 5.1 by default, but is compatible with LuaJIT 2.x if you prefer it. You need to edit the first line of index.cgi in order to switch interpreter.

Installing on Linux

NOTE: You don’t require to do the following if you are using Docker.

Debian 6.0 or later

$ sudo apt-get install uuid-dev
$ sudo luarocks install luuid 20120501-1 #32bits
$ sudo luarocks install luuid 20120501-1 LIBUUID_LIBDIR=/usr/lib/x86_64-linux-gnu/ #64bits
$ sudo luarocks install lrandom 20120430.51-1
$ sudo luarocks install dkjson
$ sudo luarocks install seawolf

Optionally:

4. Installation wizard

Open your Ophal installation in a web browser, you should be redirected to the Installation Wizard, follow the instructions. The wizard will check dependencies and ask for configuration parameters, then will generate a settings.lua file for you, create it into the same directory of index.cgi, make the desired changes an set it to read-only.

If you are using Docker then you can run this command:

$ docker exec ophal hostname -i
172.17.0.1

You can now visit http://172.17.1 (assuming that is the output from previous command). Yet it will not necessarily work for you, since Docker has different ways to setup in MAC and Windows than in Linux. All you need to make sure is to access your container over the port 80 (which might be accessible via another local port by your operating system).

5. Send your feedback

Whether you successfully installed Ophal or not, please send your feedback about Ophal installation in order to help us improve the installation instructions and the Installation Wizard.

Load stats:
- Wall Time: 23.5 ms
- MemUse: 414.79 Kb