Skip to content

Installation: Ubuntu & Ngnix

In this tutorial you will learn how to install imperia CMS on a Nginx 1.10.x web server and on a Ubuntu 18.04 server.

Prerequisites#

The following steps must be completed before you can follow the instructions:

  • You need access to a Ubuntu 18.04 server.

  • Make sure that a sudo user is available on your server: The steps in this tutorial are performed with a non-root user named "otto" with sudo privileges. How to create a user with sudo privileges is explained in the Ubuntu guide.

  • The Apache web server should already be installed and configured. In the Ubuntu Guide, you will learn how to install the Apache web server.

Download imperia CMS and prepare installation#

Step 1: Download installation package#

The installation package can be downloaded from imperia's Support page.

It is a Tar.gz archive file, which may have a file name like: imperia-11.0.0.tar.gz

Step 2: Transfer installation package to server#

Copy this file to the server where you want to install imperia CMS. It is a good idea to copy the file to /tmp, as the installation package is no longer required after installation.

How exactly you transfer the installation package to the Ubuntu server is up to you. One possibility is the command line tool scp:

scp ~/Downloads/imperia-11.0.0.tar.gz otto@ubuntuserver:/tmp

Step 3: Extract installation package#

Connect via ssh to the server you would like to install imperia CMS on, e.g. with the command line tool ssh:

ssh otto@ubuntuserver

Navigate to the directory to which you previously copied the installation package:

cd /tmp

Unpack the installation file:

sudo -u www-data tar xzf imperia-11.0.0.tar.gz 

Note

Here you unpack the installation package as www-data so that you can execute the included installation script as www-data.

Step 4: Set up root directory for imperia CMS#

Next, create a directory for imperia CMS on the server. This directory is the root directory of imperia CMS.

sudo mkdir -p /var/www/imperia/dev

Note

You can select any directory here. In this tutorial /var/www/imperia/dev is used as root directory.

Now transfer the directory rights to the user www-data:

sudo chown www-data:www-data /var/www/imperia/dev

This is necessary for the web server user to be able to write here.

Step 5: Install installation requirements#

Before you can install imperia CMS on your server, some software dependencies have to be installed.

Start by updating the local package index to take the latest changes into account:

sudo apt-get update

With this command you simply install the software packages from the Ubuntu repository:

sudo apt-get install -y libdbd-sqlite3-perl perlmagick

In this way, you install the lightweight SQLite database including the associated Perl interface and the image processing software ImageMagick as well as the associated Perl interface.

Install imperia CMS#

Step 1: Run installation script#

Install imperia CMS by running the Perl installation script as user www-data:

sudo -u www-data perl /tmp/imperia-11.0.0/install.pl -s /var/www/imperia/dev/site

Note

The above command assumes that your installation files are in the /tmp directory and that you are running imperia 11.0.0.

Step 2: Select editorial system#

In the dialog you are first asked whether you want to install an editorial system (develop) or a target system (live):

Server type (develop/live) to be installed [develop]:

Since an editorial system is to be installed here, confirm the preselection develop with ENTER.

Step 3: Specify the site directory#

Then enter the path for the site directory. The software will be installed in this directory and the template and user data can also be found here.

Absolute path to your site directory [/var/www/imperia/dev/site]:

The root directory is extended by the path /site by default. You can leave this preselection as it is and confirm with ENTER.

Step 4: Specify the HTDOCS directory#

Next the path for the htdocs directory should be specified. This directory contains the staging website and some system data.

Absolute path to your web server document root [/var/www/imperia/dev/htdocs]:

The root directory is extended by the path /htdocs by default. You can leave this preselection as it is and confirm with ENTER.

Step 5: Specify CGI directory#

Then the path for the CGI directory should be specified. This directory contains CGI scripts and is not actually needed for a minimal installation. If you are considering using imperia CMS's full-text search, you should still set it up.

Absolute path to your web server CGI directory [/var/www/imperia/dev/cgi-bin]:

Since this manual installs imperia CMS under mod_perl, no CGI directory is required. Therefore enter none and confirm with ENTER to skip the setup.

Step 6: Check and confirm#

Once all the questions have been answered, the installation script lists all the details again and asks you to start the installation.

Operating system type                     :  'Unix' (linux)
Server type to be installed               :  'develop'
Absolute path to CGI-BIN directory        :  none
Absolute path to SITE-DIR directory       :  '/var/www/imperia/dev/site'
Absolute path to DOCUMENT-ROOT directory  :  '/var/www/imperia/dev/htdocs'

Do you want to start the installation (Yes|no)? 

Check the list and confirm the preselection (Yes) with ENTER.

If you want to correct an error, enter "no" and repeat from step 2.

After you have confirmed the entries, imperia will be installed in the directory you specified.

Step 7: Memorize superuser password#

A superuser password is generated at the end of the installation process. Make a note of it, you will need it later.

Example password from an installation process:

**************************************************************************
**************************************************************************
** The superuser password for this installation is:                     **
**                                                                      **
**    NlMTe2Ds1K                                                        **
**                                                                      **
** You can change it to your taste once you have logged in.             **
**************************************************************************
**************************************************************************

Note

Search the site/logs/install.log file for "superuser password" if you missed the output. Remember to change the password once you are logged in. The corresponding username is "superuser".

Configure the web server#

Now the Nginx must be configured in a way that the internal imperia server is placed behind the nginx server as reverse proxy.

Step 1: Create server block#

Create a server block file for the imperia editorial system.

sudo vi /etc/nginx/sites-available/imperia-dev.conf

Step 2: Configure server block#

Insert the following instructions into the server block file.

server { 

    listen 2304;

    root  /var/www/imperia/dev/htdocs;
    ssi on;

    location /imp/ {
        # Wichtig: Ohne Slash am Ende!
        proxy_pass http://localhost:2404;

        # proxy_set_header Host $host:$server_port;
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /cgi-bin/ {
        # Wichtig: Ohne Slash am Ende!
        proxy_pass http://localhost:2404;

        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    access_log /var/www/imperia/dev/site/logs/access.log;
    error_log /var/www/imperia/dev/site/logs/error.log;

}

Explanation

The document root is configured with root.

With "ssi on" Server Side Include (SSI) is activated.

The location blocks contain instructions for specific areas of the site. We need to redirect all requests below /imp/ to the imperia server.

Within the location block you will find the proxy statements. With proxy_pass you specify where the request should be sent. In our case on localhost port 2404, the imperia server.

With proxy_set_header additional headers can be set. The four X-forwarded-...-headers specified here are standard for reverse proxies.

Warning

The semicolons are important. The log directory (in the example /var/www/imperia/dev/site/logs) must exist.

Step 3: Activate server block#

Then activate the file by creating a link to the sites-enabled directory from which Nginx reads at the start:

sudo ln -s /etc/nginx/sites-available/imperia-dev.conf /etc/nginx/sites-enabled/

Step 4: Start Nginx and internal web server#

Now you have to restart nginx:

sudo systemctl restart nginx

and also the internal webserver of imperia CMS:

sudo -u www-data perl /var/www/imperia/dev/site/bin/site_imperia.pl -i -t Net::Server::PreFork

The imperia development server is now available at http://www.example.com:2304/imp/

Login to imperia CMS#

Step 1: Call imperia CMS in your browser#

imperia CMS now runs under the IP of the server and under the port that you configured in the Apache web server configuration file.

Example URL

http://159.69.60.4:2504/imp/

Step 2: Login to imperia CMS#

Log in with the name superuser and the noted password.

Name: superuser
Passwort: NlMTe2Ds1K

Additional remark#

To complete the picture, a location block for CGI has been added to the nginx configuration above. So if you want to use CGI, you have to adjust system.conf to make the imperia server support CGI:

IMPERIA_SERVER_CGI_DIR = /var/www/imperia/dev/cgi-bin
IMPERIA_SERVER_CGI_BIN = /cgi-bin

How do you proceed from here?#

If imperia CMS is now running and can be accessed via your browser, you can now log in as a superuser and start with the administration of the system. Continue here:

Administration documentation

In this tutorial you have only installed the editorial system. However, since imperia CMS is a staging system, you also need to install a target system. This relationship is described in the operating concept:

Operating concept of imperia

You don't want to start the internal imperia web server manually every time you restart the server? Then you can also set up a system service to automate the start.

imperia Webserver Autostart