Install Fuel CMS on an Ubuntu 14.04 VPS with Nginx, PHP-FPM and MySQL

fuelcmsFuel CMS is a lightweight, highly customizable CMS built with the very popular PHP framework CodeIgniter. You can create custom modules, views and controllers and use the CMS part only when you need it. It is a hybrid of a framework and a CMS.

In this tutorial we will cover the steps needed for installing Fuel CMS on an Ubuntu 14.04 VPS with Nginx, PHP-FPM and MySQL.

REQUIREMENTS

We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.

UPDATE THE SYSTEM

Make sure your server is fully up to date using:

# apt-get update && apt-get upgrade

Your next step is to install Nginx, PHP-FPM and MySQL. Run the following command:

# apt-get install nginx php5-fpm mysql-server php5-mysql

Then, create the database needed for Fuel CMS. Log into your MySQL service as root:

# mysql -u root -p

mysql> create database fuel;

mysql> grant all privileges on fuel.* to fuelusr@localhost identified by 'your_password';

mysql> flush privileges;

mysql> exit
Bye

INSTALL FUEL CMS

Now, install Fuel CMS. For our purposes we will download Fuel into the /opt directory. Run the following commands:

# cd /opt

# wget https://codeload.github.com/daylightstudio/FUEL-CMS/zip/master

Unzip the downloaded archive:

# unzip master

Rename the directory into a simpler name:

# mv FUEL-CMS-master/ fuelcms

Move the Fuel CMS installation into /var/www/ :

# mv fuelcms/ /var/www/

Enter the directory:

# cd /var/www/

Configure the fuel/application/config/database.php file with the proper database connection settings. With your favorite text editor open the file, we are using vim:

# vim fuelcms/fuel/application/config/database.php

Fill in the credentials of the database you created previously. After modifying, the lines should look like this:

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'fuelusr';
$db['default']['password'] = 'your_password';
$db['default']['database'] = 'fuel';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Save and close the file.

Now, import the fuel/install/fuel_schema.sql file into the newly created database. You can do that using the following command:

# mysql -u fuelusr -p fuel < fuelcms/fuel/install/fuel_schema.sql

When prompted, enter the password you set for the fuelusr user.

You need to set an encryption key and fill in the appropriate line in the fuelcms/fuel/application/config/config.php file. You can get a random encryption key at: http://randomkeygen.com/ Open the file:

# vim fuelcms/fuel/application/config/config.php

After setting up the key, our line looks like this:

$config['encryption_key'] 'RvT1WH17eg9a1w7INabs5sXUnuE3xeQX' ;

Last but not least, set additional configuration values within the MY_fuel.php file: Configure your site name and enable the admin backend:

# vim fuelcms/fuel/application/config/MY_fuel.php

$config['site_name'] = 'your_site_name';

// whether the admin backend is enabled or not
$config['admin_enabled'] = TRUE;

Set the correct ownership of the fuelcms directory:

# chown www-data: -R fuelcms/

CONFIGURE NGINX FOR FUEL CMS

Your next step is to configure an Nginx block so you can access Fuel CMS using a domain. Therefore, create a new file using the below command:

# vim /etc/nginx/sites-available/your_domain

Paste the following into the file:

server {
        listen 80 ;

        root /var/www/fuelcms;
        index index.php index.html index.htm;
        rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
        rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

        server_name your_domain.com ;

        access_log /var/log/nginx/your_domain/access.log;
        error_log /var/log/nginx/your_domain/error.log;

        location / {
                # try_files $uri $uri/ =404;
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

        }
}

Of course, you should replace the your_domain values with your actual domain.

Enable the site:

# ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/your_domain

Restart Nginx:

# /etc/init.d/nginx restart

Now, open your favorite web browser and navigate to http://your_domain.com. The welcome page for Fuel CMS will appear with instructions on finishing the installation. Nginx doesn’t use .htaccess files, so you can skip the first step. The second step is already completed, but the third isn’t. Therefore, make the required directories writable. Execute the following commands:

# chmod +x /var/www/fuelcms/fuel/application/cache/

# chmod +x /var/www/fuelcms/fuel/application/cache/dwoo/

# chmod +x /var/www/fuelcms/fuel/application/cache/dwoo/compiled

# chmod +x /var/www/fuelcms/assets/images

The fourth step is already completed.

To access the FUEL administration backend, go to:

http://your_domain.com/fuel

and use the following login credentials:

Username: admin

Password: admin

After logging in, you need to change your admin password.

That is it, you have successfully installed Fuel CMS on your Ubuntu 14.04 VPS with Nginx, PHP5-FPM and MySQL.

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 install Fuel CMS 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.

1 thought on “Install Fuel CMS on an Ubuntu 14.04 VPS with Nginx, PHP-FPM and MySQL”

  1. Pretty good submit. I became aware of your website in addition to needed to express that I have got genuinely liked looking at your website blog posts. First-class information about the online review searches.

    Reply

Leave a Comment