CodeIgniter with Apache2
I would like to use the CodeIgniter PHP framework with an Apache2 web server on a Linode. How do I properly set this up on Ubuntu?
1 Reply
What Do You Need
I'm testing this configuration with Ubuntu 18.10 and CodeIgniter v3.1.9, but you'll need:
- A running, secured Linode
- A LAMP Stack
Downloading and Installing
- Navigate to the Apache root folder
cd /var/www/html
Grab the download URL for CodeIgniter from CodeIgniter's website
Download CodeIgniter to your Linode via
wget
sudo wget https://github.com/bcit-ci/CodeIgniter/archive/3.1.9.zip
- Unzip the file
sudo unzip 3.1.9.zip
Note: My configuration didn't include unzip, so if that's the case for you, run
sudo apt install unzip
- Rename the newly unzipped folder
sudo mv CodeIgniter-3.1.9/ codeigniter
- Remove the zip file and the default Apache index page
sudo rm 3.1.9.zip && sudo rm index.html
Next Steps
At this point, you should be able to see CodeIgniter's default page by navigating to http://$IPAddress/codeigniter
in your browser, using your Linode's public IPv4 address in the place of $IPAddress
. From here, you'll want to secure your website's files by using an htaccess file, optimize MySQL, Apache, and PHP for your website, and set up your website's domain name.
More Information
The documentation for CodeIgniter is quite thorough and should be able to answer any questions that come up while you set up your website.