Ubuntu Nginx

Installing Faveo Helpdesk Freelancer, paid and Enterprise on Ubuntu

Ubuntu

Faveo can run on [Ubuntu 16.04 (Xenial Xerus),Ubuntu 18.04 (Bionic Beaver), Ubuntu 20.04 (Focal Fosa)].

Prerequisites

Faveo depends on the following:

  • Apache (with mod_rewrite enabled)
  • PHP 7.3+ with the following extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
  • MySQL 5.7+ or MariaDB 10.3+

a. LAMP Installation

Follow the instructions here If you follow this step, no need to install Apache, PHP, MySQL separetely as listed below

Run the following commands as sudoers or Login as root user by typing the command below

sudo su

b. Update your package list

apt update && apt upgrade -y

c. Nginx

Apache should come pre-installed with your server. If it’s not, install it with:

apt install nginx
systemctl start nginx
systemctl enable nginx

d. Install some Utility packages

apt install -y git wget curl unzip nano 

e. PHP 7.3+

First add this PPA repository:

apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php

Then install php 7.3 with these extensions:

apt update
apt install -y php7.3 libapache2-mod-php7.3 php7.3-mysql \
    php7.3-cli php7.3-common php7.3-fpm php7.3-soap php7.3-gd \
    php7.3-json php7.3-opcache  php7.3-mbstring php7.3-zip \
    php7.3-bcmath php7.3-intl php7.3-xml php7.3-curl  \
    php7.3-imap php7.3-ldap php7.3-gmp 

After installing PHP 7.3, run the commands below to open PHP default config file for Nginx…

nano /etc/php/7.3/fpm/php.ini

Then make the changes on the following lines below in the file and save. The value below are great settings to apply in your environments.

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
max_execution_time = 360

Setting Up IonCube

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz 
tar xvfz ioncube_loaders_lin_x86-64.tar.gz 

Make the note of path and directory from the above command.

Copy ion cube loader to Directory. Replace your yourpath below with actual path that was shown in the last step

php -i | grep extension_dir
cp ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/'replaceyourpath'
sed -i '2 a zend_extension = "/usr/lib/php/'replaceyourpath'/ioncube_loader_lin_7.3.so"' /etc/php/7.3/fpm/php.ini
sed -i '2 a zend_extension = "/usr/lib/php/'replaceyourpath'/ioncube_loader_lin_7.3.so"' /etc/php/7.3/cli/php.ini
systemctl restart nginx 
systemctl restart php7.3-fpm

e. Mysql

The official Faveo installation uses Mysql as the database system and this is the only official system we support. While Laravel technically supports PostgreSQL and SQLite, we can’t guarantee that it will work fine with Faveo as we’ve never tested it. Feel free to read Laravel’s documentation on that topic if you feel adventurous.

Install Mysql 5.7. Note that this only installs the package, but does not setup Mysql. This is done later in the instructions:

For Ubuntu 16.04 and Ubuntu 18.04

apt install -y mysql-server-5.7
systemctl start mysql
systemctl enable mysqld

For Ubuntu 20.04

apt install -y mariadb-server-10.3
systemctl start mariadb
systemctl enable mariadb

Secure your MySql installation by executing the below command. Set Password for mysql root user, remove anonymous users, disallow remote root login, remove the test databases and finally reload the privilege tables.

mysql_secure_installation 

phpMyAdmin(Optional): Install phpMyAdmin. This is optional step. phpMyAdmin gives a GUI to access and work with Database

apt install phpmyadmin

Installation steps

Once the softwares above are installed:

1. Upload Faveo

Please download Faveo Helpdesk from https://billing.faveohelpdesk.com and upload it to below directory

/var/www/faveo

2. Setup the database

Log in with the root account to configure the database.

mysql -u root -p

Create a database called ‘faveo’.

CREATE DATABASE faveo;

Create a user called ‘faveo’ and its password ‘strongpassword’.

CREATE USER 'faveo'@'localhost' IDENTIFIED BY 'strongpassword';

We have to authorize the new user on the faveo db so that he is allowed to change the database.

GRANT ALL ON faveo.* TO 'faveo'@'localhost';

And finally we apply the changes and exit the database.

FLUSH PRIVILEGES;
exit

3. Configure Nginx webserver

a. Give proper permissions to the project directory by running:

chown -R www-data:www-data /var/www/faveo
cd /var/www/faveo/
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

b. Create the faveo.conf Virtualhost

Finally, configure Nginx site configuration file for Faveo. This file will control how users access Faveo content. Run the commands below to create a new configuration file called faveo

nano /etc/nginx/sites-available/faveo.conf

Then copy and paste the content below into the file and save it. Replace the highlighted line with your own domain name and directory root location.

server {
    listen 80;
    listen [::]:80;
    root /var/www/faveo/public;
    index  index.php index.html index.htm;
    server_name  example.com www.example.com;

     client_max_body_size 100M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;       
    }

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

Save the file and exit.

c. Enable the Faveo and Rewrite Module

After configuring the VirtualHost above delete the deafult Virtualhost and enable the Faveo Virtualhost by running the commands below

rm -f /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/faveo /etc/nginx/sites-enabled/
systemctl restart nginx
systemctl restart php7.3-fpm

4. Install Faveo

Now you can install Faveo via GUI Wizard or CLI

5. Configure cron job

Faveo requires some background processes to continuously run. Basically those crons are needed to receive emails To do this, setup a cron that runs every minute that triggers the following command php artisan schedule:run.

Create a new /etc/cron.d/faveo file with:

echo "* * * * * www-data /usr/bin/php /var/www/faveo/artisan schedule:run 2>&1" | sudo tee /etc/cron.d/faveo

6. Redis Installation

Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

This is an optional step and will improve system performance and is highly recommended.

Redis installation documentation

7. SSL Installation

Secure Sockets Layer (SSL) is a standard security technology for establishing an encrypted link between a server and a client. Let’s Encrypt is a free, automated, and open certificate authority.

This is an optional step and will improve system security and is highly recommended.

Let’s Encrypt SSL installation documentation

8. Final step

The final step is to have fun with your newly created instance, which should be up and running to http://localhost or the domain you have configured Faveo with.

Updated: