Tutorial

How to Install Fuel CMS with Nginx and Let’s Encrypt SSL on Ubuntu 22.04

p1 4

Fuel CMS is an open-source content management system used for websites. It is based on the CodeIgniter PHP web framework and is used for advanced web development. It helps users create custom modules and view and use the CMS part as per their requirements. It offers a simple and user-friendly web interface to manage websites from any device.

This article will explain how to install the Fuel CMS system with Nginx and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A domain name is pointed to your server IP.
  • A root password is configured on the server.

Update the System

First, updating your system packages to the latest version is recommended. You can update them with the following command:

apt-get update -y
apt-get upgrade -y

Once all the packages are updated, you can proceed to the next step.

Install Nginx, MariaDB, and PHP

Next, you must install the Nginx web server, MariaDB, PHP, and other PHP extensions to your system. You can install all the packages with the following command:

apt-get install nginx mariadb-server php php-cli php-fpm php-mysqli php-curl php-gd php-xml php-common unzip -y

Once all the packages are installed, edit the php.ini file and change some default PHP settings:

nano /etc/php/8.1/fpm/php.ini

Change the following lines:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = UTC


Save and close the file then restart the PHP-FPM service to apply the changes:

systemctl restart php8.1-fpm

Configure MariaDB Database

Next, you will need to create a database and user for Fuel CMS. First, log into the MariaDB console with the following command:

mysql

Once you are connected, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE fuel;
MariaDB [(none)]> GRANT ALL ON fuel.* TO 'fuel'@'localhost' IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

At this point, MariaDB is configured for Fuel CMS. You can now proceed to the next step.

Install Fuel CMS

First, create a directory to store Fuel CMS content with the following command:

mkdir -p /var/www/html/fuel

Next, navigate to the Fuel CMS directory and download the latest version of Fuel CMS with the following command:

cd /var/www/html/fuel
wget https://github.com/daylightstudio/FUEL-CMS/archive/master.zip

Once the download is completed, unzip the downloaded file with the following command:

unzip master.zip

Next, move all the content from the extracted directory to your current directory with the following command:

mv FUEL-CMS-master/* .

Next, edit the database.php file and define your database settings:

nano fuel/application/config/database.php

Change the following lines:

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'fuel',
'password' => 'password',
'database' => 'fuel',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,

Next, import the Fuel CMS schema to the fuel database with the following command:

mysql -u fuel -p fuel < fuel/install/fuel_schema.sql

Next, edit the MY_fuel.php and enable the admin login:

nano fuel/application/config/MY_fuel.php

Change the FALSE to TRUE as shown below:

$config['admin_enabled’] = TRUE;

Save and close the file then create a session directory and set proper ownership:

mkdir -p /var/lib/php/session
chown -R www-data:www-data /var/lib/php/session
chown -R www-data:www-data /var/www/html/fuel

Once you are finished, you can proceed to the next step.

Configure Nginx for Fuel CMS

First, create an Nginx virtual host configuration file to serve Fuel CMS.

nano /etc/nginx/conf.d/fuel.conf

Add the following lines:

server {

listen 80;
root /var/www/html/fuel;
index index.php index.html index.htm;
server_name fuelcms.example.com;

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

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

Save and close the file then verify the Nginx for any syntax error with the following command:

nginx -t

You should get the following output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Next, restart the Nginx service to apply the changes:

systemctl reload nginx

You can now verify the status of the Nginx with the following command:

systemctl status nginx

You should see the following output:

? nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-11-20 11:20:17 UTC; 8min ago
Docs: man:nginx(8)
Process: 77816 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
Main PID: 76763 (nginx)
Tasks: 2 (limit: 2242)
Memory: 3.0M
CPU: 62ms
CGroup: /system.slice/nginx.service
??76763 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
??77817 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Nov 20 11:20:17 ubuntu2204 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 20 11:20:17 ubuntu2204 systemd[1]: Started A high performance web server and a reverse proxy server.
Nov 20 11:28:14 ubuntu2204 systemd[1]: Reloading A high performance web server and a reverse proxy server...
Nov 20 11:28:14 ubuntu2204 systemd[1]: Reloaded A high performance web server and a reverse proxy server.

At this point, Nginx is configured to host Fuel CMS. You can now proceed to access Fuel CMS.

Access Fuel CMS Web Interface

Now, open your web browser and access the Fuel CMS using the URL http://fuelcms.example.com/fuel. You will be redirected to the Fuel CMS login page:

Provide the default admin username and password as admin and click on the Login button. You should see the password reset screen:

Click on the reset password button. You should see the following screen:

Provide your new password and click on the Save button to save the changes. Now, click on the Dashboard button. You should see the Fuel CMS dashboard on the following page:

Secure Fuel CMS with Let’s Encrypt

Next, you will need to install the Certbot client package to install and manage the Let’s Encrypt SSL.

First, install the Certbot with the following command:

apt-get install python3-certbot-nginx -y

Once the installation is finished, run the following command to install the Let’s Encrypt SSL on your website:

certbot --nginx -d fuelcms.example.com

You will be asked to provide a valid email address and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected] 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for fuelcms.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/fuel.conf

Next, choose whether or not to redirect HTTP traffic to HTTPS as shown below:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to finish the installation. You should see the following output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/fuel.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://fuelcms.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=fuelcms.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/fuelcms.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/fuelcms.example.com/privkey.pem
Your cert will expire on 2023-02-20. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le- We were unable to subscribe you the EFF mailing list because your
e-mail address appears to be invalid. You can try again later by
visiting https://act.eff.org.

Now, your website is secured with Let’s Encrypt SSL. You can access it securely using the URL https://fuelcms.example.com

Conclusion

Congratulations! you have successfully installed Fuel CMS with Nginx and Let’s Encrypt SSL on Ubuntu 22.04. You can now try Fuel CMS, explore its features and start hosting your own website or blog. Feel free to ask me if you have any questions.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !