How To Deploy CodeIgniter App in Clouding

This tutorial will show you how to deploy a CodeIgniter app in Clouding CodeIgniter is the most widely used PHP framework to develop a web-based applications.

This is the latest version of Codeigniter and is supported by php 7.2+. CodeIgniter 3.1.11 is the stable version of the framework supported by PHP 5.6+.

CodeIgniter

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

Clouding

Clouding.io is a cloud provider as a service, that helps to offer you the best infrastructure service in the cloud, with exceptional customer service, and at a low cost, since servers are paid per hour.

In Clouding you can set up your dynamic and versatile Cloud VPS in less than 30 seconds. After registration, you have 5€- free balance in your account to try the service, no commitments attached.

CodeIgniter framework comes with a few server requirements. We are going to set up two VMs:

  • A local machine which will be used to bundle the CodeIgniter code and upload it to the Ubuntu server using FTP.
  • A server machine that will become the deployment target.

How To Created Dev Environment and Develop

The Pre-requisite For Codeigniter 4:

  • System must have php 7.2+.
  • The composer must be installed in the system.
  • The php internationalize package(php_intl.dll) must be enabled.

How To Configure

Step 1: Download CodeIgniter Framework.

Open the following URL in your browser https://codeigniter.com/.

Clicked on download link to download the latest version of the framework.

Step 2: Unzip CodeIgniter-4.1.4.zip file.
The framework will be downloaded as a zipped folder when you click the above link. Unzip the contents of CodeIgniter-4.1.4.zip.

Step 3: Copy the Files.
Create a project called the ci-test. You can follow the following steps to start your project. Create a new directory on your development drive, e.g, D:\ci-test.

Step 4: Update dependencies:
composer update

Step 5: The files and folder structure of CodeIgniter-4.1.4
The following files should be visible to you. Copy the contents of the aforementioned folder to your project directory, for example, D:\ci-test.

Step 6: Let’s create a server using the following command

php -S localhost:3010

Step 7: Open the below URL.
Load the following URL into your browser. http://localhost:3010/

How To deploy CodeIgniter application in Clouding

We will show you how to create a web application using the CodeIgniter framework and Nginx as a web server on Ubuntu 18.04 VPS. The CodeIgniter application will deploy on the VPS.

Prerequisites

There are the following Prerequisites for this part –

  • The CodeIgniter 4 application
  • A Clouding account
  • A server running LEMP with a minimum 2 GB of RAM.

Register Account

First, We will register an account with Clouding. We need emailid and password to create a new account.
To register your account, you will get a confirmation e-mail.

You need to click on the confirmation e-mail link. That will redirect you to the clouding dashboard and display a success message about the validated email. You also will have to provide a valid telephone number and a card with 3D Secure device. 1€ will be charged for identification purposes and will be returned.

Once your account is created, you’ll get access to the control panel and 5€-free balance for your trials.

How To Create a VPS

You need to open https://clouding.io/ login page, Which will require username and pass word to login into the account.

Once your account is created, you’ll get access to the control panel and 5€-free balance for your trials.

Click on the a new server button and select the image or app from the available list.

I am deploying a CodeIgniter app, so I am selecting the LEMP image from the app list and adding name ci-test under ‘pick a name’ input text.

create-server-clouding

Now select the RAM, CPU and SSD NVMe disc for the cloud server.

Finally, submit the new server request. You will get a confirmation e-mail within 30 seconds with server details in your registered e-mail account. It has your new server IP and password.

If you have set up a Linux server, your user will be root and if you have set up a Windows server, your user will be an administrator.

You can also get all server information into your account dashboard.

server-list-dashboard

SSH into Your VPS

We have already created ci-test vps, Now ssh into them using putty. We will login using public ip or hostname and password, You can get ftp and ssh information from the vps details page.

ftp-ssh-vps

Now cd into the /var/www/html directory, here you found index.html file.

It is recommended to update your system with the latest version. You can do it by running the following command:

Deploy Code into the LEMP

We have configured VPS and are able to access using ssh and FTP. Let’s transfer all the codeigniter application files into the /var/www/html folder.

Set Permission

Let’s set proper permission on CodeIgniter project:

chown -R www-data: /var/www/html

How To configure NGINX for Codeigniter

Let’s create a virtual host to configure nginx for codeigniter application. We will set /public folder path as a working directory.

We can use the existing default nginx configuration file but I’ll create a separate file for codeignitor application.

Run the following command to create a new configuration file called ci-test.

sudo nano /etc/nginx/sites-available/ci-test

We will add virtual host information into the above file, Let’s copy and paste the below content into the file and save it. Replace the highlighted line with your own domain name and directory root location.

Please replace box ip with your IP

Restart nginx and fpm

Now enable the Nginx virtual host and restart the Nginx and PHP-FPM service with the following command:

How To Access CodeIgniter application

You can access your codeIgniter application using hostname/ip into the browser.
http://public-ip

codeigniter-theme-home-page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.