X
    Categories: Tutorials

Install Baun CMS on an Ubuntu 14.04 VPS

In this blog post we will show you how to install Baun CMS on an Ubuntu 14.04 VPS with Nginx. Baun CMS is a modern, lightweight and extensible flat-file CMS, with no database and administration backend and is a perfect solution for small websites. The main advantages of a flat-file CMS systems are simplicity, portability, security, speed and version control. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 14.04 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 git vim

Install PHP and Nginx

The latest version of Nginx 1.6.2 is not available via the default Ubuntu repositories, so we will add the “nginx/stable” PPA, update the system and install the nginx package.

user@vps:~# sudo add-apt-repository ppa:nginx/stable
user@vps:~# sudo apt-get update
user@vps:~# sudo apt-get install nginx 
user@vps:~# sudo apt-get php5-fpm php5-cli

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 https://getcomposer.org/installer | php
user@vps:~# sudo mv composer.phar /usr/local/bin/composer

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 ~/yourBaunSite.com/{public_html,logs}
user@vps:~# git clone https://github.com/BaunCMS/Baun.git ~/yourBaunSite.com/public_html
user@vps:~# cd ~/yourBaunSite.com/public_html


Install Dependencies

Run composer install to install all dependencies user@vps:~# composer install

PHP-FPM configuration

Create a new PHP-FPM pool for your user:

user@vps:~# 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

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/yourBaunSite.com << EOF
server {
    server_name yourBaunSite.com;
    listen 80;
    root $HOME/yourBaunSite.com/public_html/public;
    access_log $HOME/yourBaunSite.com/logs/access.log;
    error_log $HOME/yourBaunSite.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

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/yourBaunSite.com /etc/nginx/sites-enabled/yourBaunSite.com
user@vps:~# sudo /etc/init.d/nginx restart

That’s it. You have successfully installed your Baun CMS. Now open your browser and type the address of your website.

For example to create a new page in Baun CMS all you need to do is to create a new .md (markdown) file in the “content” directory.  In case you never heard of markdown, it is a simple text-based markup language that can be converted to HTML. For more information about how create content, themes and plugins , please refer to the Baun 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.