Home / How To / How to install Fuel CMS with Nginx on Fedora 31

How to install Fuel CMS with Nginx on Fedora 31



Fuel CMS is an open source system for content sites and blogs. It is built on CodeIgniter, a popular PHP web framework. This tutorial will cover how to install Fuel CMS on a Fedora 31. based server.

Prerequisites

  • A server running Fedora 31

    configured with LEMP Stack. You can follow our guide to do so.

  • A non-root user.

  • Make sure everything is up to date.

      $ sudo dnf upgrade
    

Configuring MariaDB for Fuel CMS

First, we need to create a database to use for Fuel CMS. To make that login to the MySQL prompt.

  $ sudo mysql

Enter the following commands when prompted to create a database named fuelcms and a database user fueluser and grant it access to the database.

  mysql> CREATE DATABASE fuel cells;
mysql> CREATE USERS & # 39; fuel users & # 39; @ & # 39; localhost & # 39; IDENTIFIED BY & # 39; your password & # 39 ;;
mysql> GIVE ALL PRIVILEGES ON FUEL ECS. * TO & # 39; Fuel Users & # 39; @ & # 39; localhost & # 39 ;;
mysql> exit 

Configuring PHP for Fuel CMS

In our guide we installed PHP 7.4 but Fuel CMS is not yet compatible with this tutorial. When it becomes compatible, you can skip this step.

Now we need to install PHP 7.3 together with PHP 7.4. This can easily be done with the following command.

  $ sudo dnf install php73-php-fpm php73-php-mysqlnd php73-php-cli -y

This installs PHP 7.3 as a collection that lets you run it simultaneously with PHP 7.4.

Start and enable PHP 7.3 service.

  $ sudo systemctl start php73-php-fpm
$ sudo systemctl activates php73-php-fpm

To check if it is installed correctly, run the following command.

  $ php73 --version
PHP 7.3.16 (cli) (built: March 17, 2020 10:18:38 AM) (NTS)
Copyright (c) 1997-2018 PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies

Open file /etc/opt/remi/php73/php-fpm.d/www.conf .

  $ sudo nano / etc / opt / remi / php73 / php-fpm. d / www.conf

We need to set the Unix user / group of PHP processes to nginx . Find the line user = apache and = apache in the file and change them to nginx.

  ...
; Unix user / group of processes
; Note: The user is required. If the group is not set, the default user group is
; will be used.
; RPM: apache users chosen to access the same directories as httpd
user = nginx
; RPM: Keep a group allowed to enter log dir.
group = nginx
...

Also find the variable list.acl_users and change its value as follows.

  list.acl_users = nginx

Also note the variable listen . It gives you the path to where you can listen to the PHP-FPM process. For us, it shows the following.

  list = /var/opt/remi/php73/run/php-fpm/www.sock

Copy the path because we will need it.

Save the file by pressing Ctrl + X and enter Y when prompted.

Restart the PHP-fpm process.

  $ sudo systemctl restart php73-php-fpm 

Configure Nginx

Run the following command to add a Fuel CMS configuration file.

  $ sudo nano / etc / nginx / sites-available / fuel .conf

Paste the following code into the editor.

  server {
listen 80;
listen [::]: 80;
root / var / www / fuel;
index index.php index.html index.htm;
server name fuel.example.com;

client_max_body_size 100M;

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

access_log /var/log/nginx/fuel.example.com.access.log; Chapter19459039 ?? error_log /var/log/nginx/fuel.example.com.error.log; location ~ .php $ { fastcgi_pass unix: /run/php-fpm/www.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params; } }

This file assumes that we install Fuel CMS for the domain example.com and in the directory / var / www / fuel . We also used the value of the variable listen from above to enter a value for fastcgi_pass .

Activate this configuration file by linking it to directory directories .

  $ sudo ln -s /etc/nginx/sites-available/fuel.conf / etc / nginx / sites-enabled /

Test the Nginx configuration.

  $ sudo nginx -t

You should see the following output indicating that your configuration is correct.

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

Reload the Nginx service.

  $ sudo systemctl reload nginx 

Install Fuel CMS

Create an empty document root directory for Fuel CMS.

  $ sudo mkdir -p / var / www / fuel

-p argument ensures that parent directories were and www are created automatically if they are not available.

Navigate to the document root folder. Ads

  $ cd / var / www / fuel

Get the latest version of Fuel CMS from its Git archive.

  $ sudo wget https://github.com/daylightstudio/FUEL-CMS/archive/master.zip

Extract file to folder / var / www / fuel .

  $ sudo unzip master.zip
$ sudo rm master.zip
$ sudo, etc. FUEL CMS master / *.
$ sudo rm -r FUEL CMS master

Create sessions .

  $ sudo mkdir / var / www / fuel / fuel / application / sessions

Open file /var/www/fuel/application/config/database.php .

  $ sudo nano / var / www / fuel / fuel / application / config / database .php

Configure the database parameters we created earlier.

  $ db ['default'] = array (
& # 39; dsn & # 39; => & # 39; & # 39 ;,
& # 39; hostname & # 39; => & # 39; localhost & # 39 ;,
& # 39; username & # 39; => & # 39; fueluser & # 39 ;,
& # 39; password & # 39; => & # 39; your password & # 39 ;,
& # 39; database & # 39; => & # 39; fuelcms & # 39 ;,
& # 39; dbdriver & # 39; => & # 39; mysqli & # 39 ;,

Save the file by pressing Ctrl + X and enter Y when prompted.

Import /var/www/fuel/install/fuel_schema.sql file into the newly created database.

  $ mysql -u fueluser -p fuelcms </var/www/fuel/fuel/install/fuel_schema.sql

Generate a random encryption key with OpenSSL. You can use any number instead of 20.

  $ openssl rand -base64 20

You get a random key as the output. Copy it.

Open file /var/www/fuel/fuel/application/config/config.php . Ads

  $ sudo nano /var/www/fuel/fuel/application/config/config.php

Change the value of $ config [‘encryption_key’] to the key you received from the previous step.

  $ config ['encryption_key'] = & # 39; nisT56baLm + U24ZYFRvVbVKIdOE = & # 39 ;;

Then locate the value $ config [‘sess_save_path’] and change its value from NULL to the session path we created above.

  $ config ['sess_save_path'] = APPPATH.sessions / & # 39 ;;

APPPATH here refers to the catalog / var / www / fuel / fuel / applications / . To save the file, press Ctrl + X and enter Y when prompted.

Then we need to enable the administration panel. For that, open the file /var/www/fuel/fuel/application/config/MY_fuel.php .

  $ sudo nano / var / www / fuel / fuel / application / config / MY_fuel. php

Make the following change.

  // whether admin backend is enabled or not
$ config ['admin_enabled'] = TRUE;
....
$ config ['fuel_mode'] = & # 39; auto & # 39 ;;

If you set fuel_mode to auto Fuel CMS can first check its database for the page and if it is not found, it will retrieve the page from its display directory. You can change various other settings such as the site name in the Administration panel, image upload size, set an email, file transfer size, select a text editor, set an interpreter engine and its configuration, and set a list of allowed modules. ] To save the file, press Ctrl + X and enter Y when prompted.

The final step is to give the proper permissions to the / var / www / fuel directory.

  sudo chown -R nginx: nginx / var / www / fuel

The setting is now complete. Open fuel.example.com/fuel in your browser and log in with the references you created above and start developing.

Configuring Fuel CMS

When you log in to the administration panel, you will be prompted to change the password. Click Change Password to continue.

 Configure Fuel CMS

On the page that opens, you can change your password. You should also change your username and add an email address. You must also fill in your name to continue. Save to continue when you're done.

For more information, see the official Fuel CMS documentation.

Setting HTTPS with Let's Encrypt

To use Let's let us install the Certbot package.

Install Certbot.

  $ sudo dnf install certbot certbot-nginx-y

Install the certificate.

  $ sudo certbot --nginx -d fuel.example.com

If this is your first time using the tool on this server, you must agree to the terms and provide your email address. Say no when asked if you would like to share your email with the EFF Foundation.

If successful, certbot will ask how to configure your HTTPS settings. [19659006] Choose whether to redirect HTTP traffic to HTTPS or remove HTTP access.
————————————————– —————————–
1: No Redirect – Do not make any further changes to the web server configuration.
2: Redirect – Makes all requests redirect to secure HTTPS access. Select this for
new websites, or if you are sure your site is working on HTTPS. You can undo this
change by editing your web server configuration.
————————————————– —————————–
Select the correct number [1-2] and then [enter] (press & # 39; c & # 39; to cancel):

Select 2 and then hit ENTER . Your certificate is now installed and activated.

Run the following command to set automatic renewal.

  $ echo "0 0.12 * * * root python -c & # 39; import random; import time; time.sleep (random) .random () * 3600) & # 39; && certbot refreshes" | sudo tee -a / etc / crontab> / dev / null

Start https://fuel.example.com in your browser to check.

 Secure fuel CMS with a free Let's encrypt SSL certificate Ads

Ads [19659119] Conclusion

This concludes our tutorial. You can now use Fuel CMS to create your websites. If you have any questions, write it in the comments.


Source link