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 [email protected]

Update the system and install necessary packages.

[email protected]:~# sudo apt-get update 
[email protected]:~# sudo apt-get -y upgrade
[email protected]:~# sudo apt-get install python-software-properties software-properties-common git vim

Install MariaDB 10.0

Add MariaDB to your sources.list

[email protected]:~# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
[email protected]:~# sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.0/debian wheezy main'

Install MariaDB:

[email protected]:~# sudo apt-get update
[email protected]:~# sudo apt-get install mariadb-server

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

mysql_secure_installation

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

[email protected]:~# mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE pagekit;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON pagekit.* TO 'pagekituser'@'localhost' IDENTIFIED BY 'pagekituser_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
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:

[email protected]:~# sudo vim /etc/apt/sources.list
deb http://packages.dotdeb.org wheezy all
deb http://packages.dotdeb.org wheezy-php56 all

Fetch and install the GnuPG key:

[email protected]:~# wget -qO - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -

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

[email protected]:~# sudo apt-get update
[email protected]:~# sudo apt-get install nginx 
[email protected]:~# 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.

[email protected]:~# curl -sS https://getcomposer.org/installer | php
[email protected]:~# sudo mv composer.phar /usr/local/bin/composer

Install Node Gulp and Bower

[email protected]:~# curl -sL https://deb.nodesource.com/setup | sudo bash -
[email protected]:~# sudo apt-get install -y nodejs
[email protected]:~# sudo npm install -g bower
[email protected]:~# 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:

[email protected]:~# mkdir -p ~/yourPagekitSite.com/{public_html,logs}
[email protected]:~# git clone https://github.com/pagekit/pagekit.git ~/yourPagekitSite.com/public_html

Install all dependencies and buld assets

[email protected]:~# cd ~/yourPagekitSite.com/public_html
[email protected]:~# composer install
[email protected]:~# npm install
[email protected]:~# bower install
[email protected]:~# gulp

PHP-FPM configuration

Create a new PHP-FPM pool for your user:

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

Restart PHP-FPM

[email protected]:~# sudo service php5-fpm restart

Nginx configuration

Create a new Nginx server block with the following content:

[email protected]:~# sudo tee /etc/nginx/sites-available/yourPagekitSite.com << EOF
server {
    server_name yourPagekitSite.com;
    listen 80;
    root $HOME/yourPagekitSite.com/public_html;
    access_log $HOME/yourPagekitSite.com/logs/access.log;
    error_log $HOME/yourPagekitSite.com/logs/error.log;
    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;
    }
 
}
EOF

Test the Nginx configuration:

[email protected]:~# sudo nginx -t

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

[email protected]:~# sudo ln -s /etc/nginx/sites-available/yourPagekitSite.com /etc/nginx/sites-enabled/yourPagekitSite.com
[email protected]:~# sudo /etc/init.d/nginx restart

Final steps

Open your browser and type the address of your website yourPagekitSite.com, 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.

Tutorials
How to install Tomcat 7 + JDK 7
Tutorials
How to install Observium on Ubuntu 14.04
Tutorials
How to Fix the Missing MySQL Extension Error in WordPress
There are currently no comments.

 
Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now
+