ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans

How to Install FlatPress on Ubuntu 14.04

FlatPress is a blogging engine that save posts as simple text files so we don't need a database.

Several features of FlatPress:

  • Standard-compliant (XHTML valid)
  • No need to fiddle with SQL
  • Easy to backup! Just copy one directory
  • Easy plugin system
  • Widget support
  • Easy to customize with themes (powered by Smarty)

You can learn more about FlatPress from the FlatPress website.

Objective

In this tutorial we'll learn how to install FlatPress on Ubuntu 14.04. We will also install and configure its prerequisites.

Prerequisites

We will install FlatPress on a fresh installation of Ubuntu Server 14.04. We also need these application to be able to run FlatPress:

  • Apache 2
  • PHP > 5.3.1

Update Base System

Before we install FlatPress, let's update the system to the latest update.

$ sudo apt-get update
$ sudo apt-get -y upgrade

Install Apache 2

After applying latest update to our base system, Lets's start installing Apache 2 and required libraries.

$ sudo apt-get -y install apache2 apache2-bin apache2-data apache2-mpm-prefork libaio1 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libterm-readkey-perl libwrap0 ssl-cert tcpd

We can check Apache 2 service status using command below:

sudo service apache2 status
 * apache2 is running

We can also check whether Apache 2 is listening on which port using command below.

 sudo netstat -naptu | grep apache
tcp6       0      0 :::80                   :::*                    LISTEN      14873/apache2

Install PHP 5

The last component that we have to install before we can install flatpress is PHP 5. We will install PHP 5 and several common PHP libraries.

$ sudo apt-get -y install php5-cli php5-common php5-json php5-readline

Restart Apache 2 process so the changes will be applied:

$ sudo service apache2 restart

Install Flatpress

All prerequisites are already installed. So we're ready to install flatpress. The latest stable version of flatpress is available FlatPress download page.

At the time of this writing, the latest stable version is version 1.0.3, let's download flatpress compressed file using wget.

$ wget -c https://github.com/evacchi/flatpress/archive/v1.0.3.tar.gz

Extract FlatPress archive:

$ tar xzf v1.0.3.tar.gz

Move flatpress-1.0.3 folder to Apache directory as flatpress.

$ sudo mv flatpress-1.0.3 /var/www/flatpress

Change ownership of flatpress directory to www-data user and group.

$ sudo chown -R www-data:www-data /var/www/flatpress

Flatpress files is ready, now let's create Apache Virtual Host configuration to serve flatpress.

Configure Apache Virtual Host for http Only

Create new apache configuration file on /etc/apache2/sites-available/flatpress.conf with contents below.

<VirtualHost *:80>
    ServerName flatpress.exampleserver.xyz

DocumentRoot /var/www/flatpress

<Directory /var/www/flatpress> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory>

ErrorLog ${APACHE_LOG_DIR}/flatpress.exampleserver.xyz-error.log CustomLog ${APACHE_LOG_DIR}/flatpress.exampleserver.xyz-access.log combined

</VirtualHost>

Don't forget to change flatpress.exampleserver.xyz above with the domain name that you use for your flatpress installation.

Enable the site using a2ensite command.

$ sudo a2ensite flatpress

Reload the apache2 process so it read the new virtualhost configuration:

$ sudo service apache2 reload

FlatPress Installer

Open the FlatPress URL, we will be redirected to FlatPress installer.

First step, click Next

Create admin user. input username, password email and FlatPress URL. Click Next

Done. FlatPress installation finished.

Our FlatPress site is ready.

When we click login from the sidebar of the homepage we will get FlatPress login prompt.

After successfully login we will go to FlatPress administration are where we can manage our FlatPress site.

Configure https only site for flatpress

Secure connection is now a requirement for web application.

Last step that we will do in this tutorial is changing the connection to only use https.

We assume that you already have SSL certificate and private key.

Let's create new apache virtual host configuration on /etc/apache2/sites-available/flatpress-ssl.conf with contents below. Don't forget to change:

  • ServerName
  • SSLCertificateFile
  • SSLCertificateChainFile
  • SSLCertificateKeyFile
<VirtualHost *:80>
   ServerName flatpress.exampleserver.xyz
   Redirect permanent / https://flatpress.exampleserver.xyz/
</VirtualHost>

<VirtualHost *:443>

ServerName flatpress.exampleserver.xyz

DocumentRoot /var/www/flatpress

<Directory /var/www/flatpress> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory>

ErrorLog ${APACHE_LOG_DIR}/flatpress.exampleserver.xyz-error.log CustomLog ${APACHE_LOG_DIR}/flatpress.exampleserver.xyz-access.log combined

SSLEngine on SSLCertificateFile /etc/apache2/ssl/flatpress.exampleserver.xyz.crt SSLCertificateChainFile /etc/apache2/ssl/flatpress.exampleserver.xyz.crt SSLCertificateKeyFile /etc/apache2/ssl/flatpress.exampleserver.xyz.key

# Uncomment the following directive when using client certificate authentication #SSLCACertificateFile /path/to/ca_certs_for_client_authentication

# HSTS (mod_headers is required) (15768000 seconds = 6 months) Header always set Strict-Transport-Security "max-age=15768000"

</VirtualHost>

# intermediate configuration, tweak to your needs SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS SSLHonorCipherOrder on

We will also disable flatpress http only virtual host and enable the new virtual host config.

$ sudo a2dissite flatpress
$ sudo a2ensite flatpress-ssl

The new virtual host configuration need ApacheĀ mod_ssl and mod_headers modules. We need to enable those modules.

$ sudo a2enmod ssl
$ sudo a2enmod headers

Now, restart Apache 2 service so it will reload its configuration. We need to restart instead of reload since we enable new module.

$ sudo service apache2 restart

We need to change flatpress configuration to works with https.

Open /var/www/flatpress/defaults.php. Find this line

define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);

Replace the http:// above with https://

Summary

In this tutorial we learned how to install flatpress on Ubuntu 14.04.

We installed all the prerequisites and also configure Apache 2 virtual hosts to be able to serve flatpress.

We also configure https settings for flatpress so we run FlatPress securely.

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans