Question

How to set up web application developed in CodeIgniter up and run?

I am technical enthusiast with no technical educational background. I have a task in front of me. I have a web application build on LAMP and CodeIgniter. I would like to host this web application on to Digital Ocean and make it up and run to go live. So I created an account and created a droplet in Digital Ocean with the OS as Cent OS. I have not created any SSH key when I created the droplet in Digital Ocean. I have installed LAMP, PHP, MySql. I have created Maria DB as well. I have also had uploaded my developed web applicatin on to the droplet using FileZilla. Now I want to make my application up and run to go live. Being a non technical person with no hands on experience in cloud server operation I need a help to create a Standard Operating Procedure for my application to go live. So please provide me a step by step information as how to make my application up and run and go live in Digital Ocean.

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
October 12, 2023

Heya,

Setting up a web application to run on a DigitalOcean droplet involves several steps. Given that you’ve already set up LAMP and uploaded your application it will shorten the process. Let’s begin:

Step-by-Step Guide for Deploying CodeIgniter Application on DigitalOcean:

1. Setting Up MySQL/MariaDB Database:

1.1. Accessing MariaDB/MySQL:

mysql -u root -p

Enter the root password you set up during the MariaDB installation.

1.2. Create a Database and User: Replace your_database_name, your_username, and your_password with your desired names and a secure password.

CREATE DATABASE your_database_name;
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'your_username'@'localhost';
FLUSH PRIVILEGES;
EXIT;

2. Configuring CodeIgniter Application:

2.1. Database Configuration: Navigate to your application’s application/config/database.php file. Update the hostname, username, password, and database fields with the MariaDB credentials you just created.

2.2. Base URL Configuration: Update the base_url in application/config/config.php to match your domain or IP address:

$config['base_url'] = 'http://your_domain_or_IP/';

3. Configuring Apache:

3.1. Create a VirtualHost: Create a new configuration file for your application:

sudo nano /etc/httpd/conf.d/your_domain_or_IP.conf

3.2. Add the Following Configuration: Make sure to replace DocumentRoot, ServerName, and Directory paths with the path to your uploaded application:

<VirtualHost *:80>
   DocumentRoot /path_to_your_application
   ServerName your_domain_or_IP

   <Directory /path_to_your_application>
      AllowOverride All
   </Directory>
</VirtualHost>

3.3. Restart Apache:

sudo systemctl restart httpd

4. Adjusting Firewalls (if enabled):

If you have firewalld enabled on your CentOS droplet, you need to allow HTTP traffic.

4.1. Allow HTTP Traffic:

sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload

. Test the Application:

5.1. Access the application via your browser using your domain or droplet IP address.

6. Setting Up a Domain (Optional):

If you have a domain name that you’d like to point to your droplet:

6.1. Go to your domain registrar’s website and navigate to the DNS settings.

6.2. Create an A record that points to your DigitalOcean droplet’s IP address.

6.3. It might take some time for DNS changes to propagate across the internet.

Final Note:

Remember, operating a web server requires maintenance. Regularly check for updates for your operating system, PHP, MariaDB, and other components. Always backup your application and database before making major changes. And always keep security in mind – regularly review best security practices and consider employing additional security measures like Fail2ban, setting up an SSL certificate, etc.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel