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

concrete5Concrete5 is a powerful open source content management system (CMS) written in PHP. It is designed for users with a minimum of technical skills thus allowing them to deploy complex content driven websites and easily manage their content and structure.

Concrete5 comes with many features such as WYSIWYG text editor, integrated spellchecker, content scheduling, advanced permissions system and more.

In this article we will cover the steps needed for installing Concrete5 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

Once we have the main components installed, let’s tweak the PHP5-FPM configuration settings. Open the php.ini file with the following command:

vim /etc/php5/fpm/php.ini

Of course if you are unfamiliar with the vim text editor, use your favorite one.

Now, locate the line with the content ‘cgi.fix_pathinfo‘ . This will be commented by default and set to 1. Uncomment the line (remove the semi-colon) and change the value from 1 to 0.

Then, find the lines below and modify them with the underneath values:

post_max_size = 20M
upload_max_filesize = 20M
memory_limit = 128M

Restart Nginx and PHP5-FPM for the changes to take effect:

# service nginx restart

# service php5-fpm restart

Once that is done, create a database which we will later use for the installation of Concrete5.

Enter MySQL as root:

# mysql -u root -p

mysql> CREATE DATABASE concrete5;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON concrete5.* TO 'concr5'@'localhost' IDENTIFIED BY 'your_password';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit

INSTALL CONCRETE5

We will download Concrete5 in the opt directory. Execute the following commands:

# cd /opt

# wget https://www.concrete5.org/download_file/-/view/79252/ -O concrete5.zip
   
# unzip concrete5.zip

# mv concrete5.7.4.2/ /var/www/concrete5

What we’ve done here is:

- entered the opt directory;
- downloaded the latest version of Concrete5;
- unzipped the archive;
- Moved the directory to /var/www/ and renamed it to an easier name

Navigate to /var/www/ :

# cd /var/www/

Set the proper ownership of Concrete5 files and directories:

# chown -R www-data: concrete5/

CONFIGURE NGINX FOR CONCRETE5

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

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

Paste the following in to the file:

server {
        listen 80 ;

        root /var/www/concrete5/;
        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 ;

        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;

        }
}

Don’t forget to 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 for the changes to take effect:

# service nginx restart

Now, open your favorite web browser and navigate to http://your_domain to finish the Concrete5 installation. The installer is easy to follow, so when you reach the page that asks you to enter the database credentials, use the ones of your created database earlier.

Congratulations, you have successfully installed Concrete5.

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 Concrete5 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.

2 thoughts on “Install Concrete5 on an Ubuntu 14.04 VPS with Nginx, PHP-FPM and MySQL”

  1. i should do ‘mkdir’ these 2 dilectories.
    /var/www/
    /var/log/nginx/your_domain/

    especially it takes long time to figured out why nginx failed to restart after CONFIGURE NGINX FOR CONCRETE5 step.

    Reply

Leave a Comment