How to Install SilverStripe on Debian 8

How to install SilverStripe on Debian 8

In this tutorial we are going to provide you with step-by-step instructions on how to install SilverStripe CMS with Nginx on a Debian VPS. SilverStripe is a content management system (CMS) that includes a programming framework used by website developers for creating and maintaining websites and web applications.

Let’s start with the SilverStripe CMS installation procedure.

1. Login via SSH and Update the System

Make sure your package list and the OS packages are up to date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

2. Download Latest Nginx Version

To install the latest Nginx version from the official Nginx repository, edit the ‘/etc/apt/sources.list’ file:

sudo vi /etc/apt/sources.list

Add the following lines:

deb http://nginx.org/packages/debian/ jessie nginx
deb-src http://nginx.org/packages/debian/ jessie nginx

3. Install MySQL Server

sudo apt-get install mysql-server

Stop and remove Apache service:

sudo service apache2 stop
sudo apt-get remove apache2

4. Install Nginx

Install Nginx on your virtual server:

wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
sudo apt-get update
sudo apt-get install nginx

5. Configure Nginx

Configure Nginx to start on boot:

sudo update-rc.d -f nginx defaults

6. Install PHP and PHP Modules

Install PHP and PHP modules required by SilverStripe CMS:

sudo apt-get install php5 php5-cli php5-fpm php5-tidy php5-curl php5-mysql php5-gd php5-mcrypt php5-imap mcrypt

7. Download, Install and Configure SilverStripe CMS

Get the latest version of SilverStripe CMS available at http://silverstripe.org/download to a directory of your virtual server and extract it using the following commands:

sudo apt-get install wget unzip
cd /opt/
wget https://silverstripe-ssorg-releases.s3.amazonaws.com/sssites-ssorg-prod/assets/releases/SilverStripe-cms-v3.4.0.zip
mkdir -p /var/www/html/silverstripe
unzip SilverStripe-cms-v3.4.0.zip -d /var/www/html/silverstripe

Create a new Nginx configuration file and add the following virtual block for your domain name:

vi /etc/nginx/conf.d/your-domain.com.conf

Add the following lines:

server {
    listen 80;  

    server_name your-domain.com www.your-domain.com;
    root /var/www/html/silverstripe;

    if ($http_x_forwarded_host) {
        return 400;
    }

    location / {
        try_files $uri /framework/main.php?url=$uri&$query_string;
    }

    error_page 404 /assets/error-404.html;
    error_page 500 /assets/error-500.html;

    location ^~ /assets/ {
        sendfile on;
        try_files $uri =404;
    }

    location ~ /framework/.*(main|rpc|tiny_mce_gzip)\.php$ {
        fastcgi_keep_conn on;
        fastcgi_index  index.php;
        fastcgi_pass   127.0.0.1:9000;        
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /(mysite|framework|cms)/.*\.(php|php3|php4|php5|phtml|inc)$ {
        deny all;
    }

    location ~ /\.. {
        deny all;
    }

    location ~ \.ss$ {
        satisfy any;
        allow 127.0.0.1;
        deny all;
    }

    location ~ web\.config$ {
        deny all;
    }

    location ~ \.ya?ml$ {
        deny all;
    }

    location ^~ /vendor/ {
        deny all;
    }

    location ~* /silverstripe-cache/ {
        deny all;
    }

    location ~* composer\.(json|lock)$ {
        deny all;
    }

    location ~* /(cms|framework)/silverstripe_version$ {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_keep_conn on;
        fastcgi_index  index.php;
        fastcgi_pass   127.0.0.1:9000;        
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_buffer_size 32k;
        fastcgi_busy_buffers_size 64k;
        fastcgi_buffers 4 32k;
    }
}

Do not forget to replace your-domain.com with your actual domain name. Then, delete the ‘default’ Nginx configuration file:

rm /etc/nginx/conf.d/default.conf

Open the ‘/etc/php5/fpm/pool.d/www.conf’ file and change the ‘listen’ variable.

Change:

listen = /var/run/php5-fpm.sock

to

listen = 127.0.0.1:9000;

Edit the ‘/etc/php5/fpm/php.ini’ configuration file:

vi /etc/php5/fpm/php.ini

Add/modify the following settings:

safe_mode = Off
magic_quotes_gpc = Off
memory_limit = 128M
date.timezone = "America/Chicago"

The web server user (www-data) needs to be able to write to files and directories inside the ‘/var/www/html/silverstripe’ directory, so it can easily be accomplished by executing the following command:

sudo chown www-data:www-data -R /var/www/html/silverstripe/

8. Test Nginx

Test the Nginx configuration:

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If test is successful, restart php5-fpm and Nginx services for the changes to take effect:

sudo service php5-fpm restart
sudo service nginx restart

9. Create New Database

SilverStripe CMS requires a database to work as this is where data is saved, so create a new MySQL database:

mysql -u root -p
mysql> create database ssdb;
mysql> GRANT ALL PRIVILEGES ON ssdb.* TO 'ssuser'@'localhost' IDENTIFIED BY 'Y0UR-PASSW0RD';
mysql> flush privileges;
mysql> quit

Open http://your-domain.com/ using your favorite web browser and follow the easy instructions, i.e. enter the following:

Database server: MySQL 5.0+ (using MySQLi)
Database username: ssuser
Database password: Y0UR-PASSW0RD
Databasename: ssdb

Then, click ‘Re-check requirements’ and if everything is OK, enter the administrator email address and password and click ‘Install SilverStripe’.

You should remove install.php from the SilverStripe install for security reasons:

rm /var/www/html/silverstripe/install.php

10. Configure SilverStripe in Web Browser

Once installed, log in to the administrator back-end at http://your-domain.com/admin and configure SilverStripe CMS according to your needs.
silverstripe back-end

That is it. The SilverStripe CMS installation is now complete.


Of course you don’t have to Install SilverStripe on Debian8, if you use one of our Debian VPS hosting services, in which case you can simply ask our expert Linux admins to Install SilverStripe on Debian8 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to Install SilverStripe on Debian8, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment