Install Pagekit on a Debian 7 VPS with Nginx, PHP-FPM and MariaDB

install-pagekit-on-a-debian-7-vps-with-nginx-php-fpm-and-mariadbIn this blog post we will show you how to install Pagekit on a Debian 7 VPS with Nginx PHP-FPM and MariaDB. Pagekit is a new modern CMS build on top of the Symfony framework which you can use to build your website or blog.This guide should work on other Linux VPS systems as well but was tested and written for Debian 7 VPS.


Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages.

user@vps:~# sudo apt-get update 
user@vps:~# sudo apt-get -y upgrade
user@vps:~# sudo apt-get install python-software-properties software-properties-common git vim

Install MariaDB 10.0

Add MariaDB to your sources.list

user@vps:~# sudo apt-key adv --recv-keys --keyserver hkp:// 0xcbcb082a1bb943db
user@vps:~# sudo add-apt-repository 'deb wheezy main'

Install MariaDB:

user@vps:~# sudo apt-get update
user@vps:~# sudo apt-get install mariadb-server

When the installation is complete, run the following command to secure your installation:


Next, we need to create a database for our Pagekit installation.

user@vps:~# mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE pagekit;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON pagekit.* TO 'pagekituser'@'localhost' IDENTIFIED BY 'pagekituser_passwd';
MariaDB [(none)]> \q

Install PHP and Nginx

The latest versions of Nginx and PHP are not available via the default Debian repositories, so we will add the Dotdeb repository. Open the /etc/apt/sources.list file and append the following lines:

user@vps:~# sudo vim /etc/apt/sources.list
deb wheezy all
deb wheezy-php56 all

Fetch and install the GnuPG key:

user@vps:~# wget -qO - | sudo apt-key add -

Update the system and install Nginx, PHP and all necessary extensions:

user@vps:~# sudo apt-get update
user@vps:~# sudo apt-get install nginx 
user@vps:~# sudo apt-get install php5-fpm php5-cli php5-json php5-apcu php5-curl

Install Composer

Composer is a dependency manager for PHP with which you can install packages. Composer will pull all the required libraries you need for your project.

user@vps:~# curl -sS | php
user@vps:~# sudo mv composer.phar /usr/local/bin/composer

Install Node Gulp and Bower

user@vps:~# curl -sL | sudo bash -
user@vps:~# sudo apt-get install -y nodejs
user@vps:~# sudo npm install -g bower
user@vps:~# sudo npm install -g gulp

Clone the git repository

Create a root directory for your web site and clone the git repository from github using the following commands:

user@vps:~# mkdir -p ~/{public_html,logs}
user@vps:~# git clone ~/

Install all dependencies and buld assets

user@vps:~# cd ~/
user@vps:~# composer install
user@vps:~# npm install
user@vps:~# bower install
user@vps:~# gulp

PHP-FPM configuration

Create a new PHP-FPM pool for your user:

user@vps:~# sudo tee /etc/php5/fpm/pool.d/$(whoami).conf << EOF
user = $(whoami)  
group = $(whoami)  
listen = /var/run/php5-fpm-$(whoami).sock  
listen.owner = $(whoami) = $(whoami)  
listen.mode = 0666  
pm = ondemand  
pm.max_children = 5  
pm.process_idle_timeout = 10s;  
pm.max_requests = 200  
chdir = /  

Restart PHP-FPM

user@vps:~# sudo service php5-fpm restart

Nginx configuration

Create a new Nginx server block with the following content:

user@vps:~# sudo tee /etc/nginx/sites-available/ << EOF
server {
    listen 80;
    root $HOME/;
    access_log $HOME/;
    error_log $HOME/;
    index index.php;
    location / {
        try_files \$uri \$uri/ /index.php?\$args;
    location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)\$ {
        access_log off;
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
    location ~ \.php\$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)\$;
        fastcgi_pass unix:/var/run/php5-fpm-$(whoami).sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    location ~ /\.ht {
        deny all;

Test the Nginx configuration:

user@vps:~# sudo nginx -t

Activate the server block by creating a symbolic link and restart nginx:

user@vps:~# sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
user@vps:~# sudo /etc/init.d/nginx restart

Final steps

Open your browser and type the address of your website, enter the database information and create your first user.

That’s it. You have successfully installed your Pagekit. For more information about Pagekit, please refer to the Pagekit website.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How to install and integrate DKIM with OpenDKIM and Postfix on a CentOS 6 VPS
Install Vtiger CRM on CentOS 7
How to install NodeJS, Bower and Gulp on a CentOS 7 VPS
There are currently no comments.