Exbita Installation Guide

Exbita was build in Laravel Framework and the installation process requires several cli commands to be executed. We will describe all required steps in this section.

Tutorial



Upload project files


1. Download EnvatoRelease.zip file from Codecanyon

2. Upload archived file to the server directory /var/www/html

3. Open /var/www/html folder and Unzip archived file

unzip EnvatoRelease.zip

4. Move files inside the project folder

mv -f /var/www/html/project/*/ /var/www/html
mv /var/www/html/project/.[!.$]* /var/www/html

NOTE: the second command is moving hidden files (e.g .env file)

5. Delete uploaded archived file along with project folder.

rm -rf /var/www/html/project/* /var/www/html/docs /var/www/html/EnvatoRelease.zip

If your system doesn't have unzip package, you can install it with this command: sudo apt install unzip


Directory Permissions


After the project files were uploaded, the directory permissions should be configured. You need to run the following commands:

sudo chown -R root:data /var/www/html

sudo find /var/www/html -type exec chmod 664 {}\;
sudo find /var/www/html -type exec chmod 775 {}\;

sudo chmod -R ug+rwx /var/www/html/storage /var/www/html/bootstrap/cache

NOTE: Replace root user with actual server root username and www-data with your web-server user if it's different. If site path /var/www/html is different, it needs to be also replaced with the correct path.


Nginx Configuration


1. You need to adjust an nginx configuration file before launching the app. Open the config file by typing the following command:

nano /etc/nginx/sites-available/default

If your already have prepared virtualhost domain, you need to replace default with the virtualhost config file.

If the system doesn't have nano editor, you can install it with this command: sudo apt install nano. You can find full information about this editor from this guide

2. Remove all existing content and replace with the following lines:

server {
  listen 80;
  server_name SERVER_IP_OR_DOMAIN;
  root /var/www/html;

  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-XSS-Protection "1; mode=block";
  add_header X-Content-Type-Options "nosniff";

  index index.php;

  client_max_body_size 10M;

  charset utf-8;

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

  location = /favicon.ico { access_log off; log_not_found off; }
  location = /robots.txt { access_log off; log_not_found off; }

  error_page 404 /index.php;

  location ~ \php$ {
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
  }

  location ~ /\.(?!well-known).* {
    deny all;
  }
}

NOTES:

  • change this line server_name SERVER_IP_OR_DOMAIN; to real ip address of the server or domain name
  • change this line root /var/www/html/public; if your root directory is different
  • If your Linux distribution doesn't have PHP 7.4 or uses different path, replace fastcgi_pass with your PHP-FPM path.

Run nginx -t to make sure the configuration file is properly configured. Afterwards, restart NGINX by typing the command below:

sudo systemctl restart nginx


Apache Configuration


1. Make sure you uncommented the following apache modules from httpd.conf file:

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

2. Create a new virtualhost in APACHE_PATH\conf\extra\httpd-vhosts.conf and add the lines below:

<VirtualHost *:80>DocumentRoot "SITE_ROOT_DIRECTORY/public"ServerName DOMAIN_NAME_OR_IP_ADDRESS<Directory "SITE_ROOT_DIRECTORY/public">Options Indexes FollowSymLinks MultiViewsAllowOverride AllOrder allow,denyallow from allRequire all granted</Directory></VirtualHost>
  • <VirtualHost *:80> change this line if you use different port number than 80.
  • DocumentRoot and <Directory> should be replaced with actual directory of your site. Don't forget to add public folder to the end (e.g. DocumentRoot "/var/www/exbita.com/public")
  • ServerName DOMAIN_NAME_OR_IP_ADDRESS should be replaced with domain name or ip address of the server. (e.g. ServerName exbita.com)

NOTE: Make sure Include conf/extra/httpd-vhosts.conf is uncommented in APACHE_PATH\conf\httpd.conf file. You can skip this step if you use Laragon, since it uses different way to include virtualhosts.


Exbita Configuration File


1. Create database by entering to mysql interface from terminal:

  • If mysql allow authenticating without password:
mysql
  • If mysql doesn't allow authenticating without password (replace username with your real database user). Type the following command and enter database password:
mysql -u username -p

2. Once entered create database with the SQL query bellow (replace exbita with your desired database name) :

CREATE DATABASE exbita;

3. Quit mysql interface:

QUIT

4. Open project directory.

cd /var/www/html

NOTE: All further commands should be executed inside project directory.

5. Install dependencies and compile assets

composer update
npm install
npm build production

6. Go to the project folder and generate unique key to secure the app:

php artisan key:generate

7. Make sure Redis Server is up and running

If the installed redis-server doesn't use default credentials (host: 127.0.0.1 with no password) and port 6379, make sure to edit REDIS_ based variables on .env file accordingly.

8. Open .env file and modify only app url and database section:

APP_URL="http://server-ip" # replace server-ip with your real server ip address

NOTE: if you test the site locally by adding custom ports like 81, 8000 etc, you have to append the port as well (e.g. APP_URL="http://server_ip_or_domain_name:81")

DB_CONNECTION=mysql # connection type
DB_HOST="127.0.0.1" # connection host
DB_PORT=3306 # database port
DB_DATABASE=exbita # database name
DB_USERNAME=root # database username
DB_PASSWORD=root # database password

Please don't edit other configuration lines. All further configuration will be modified from Exbita's Admin Dashboard.

9. Cache config file to avoid reading .env file each time the system loads.

php artisan config:clear

10. Database migration & seed

Database migration is required to create database tables. Please make sure you created a database, database user and updated .env file from previous steps. Otherwise, the migration process will be failed. Run the following command to start migration:

php artisan migrate
php artisan passport:install --force

Please run the following command to seed initial data:

php artisan db:seed

Exbita won't work without initial migration files and seeded data, also, make sure Redis Server was installed and running.

11. Create a symbolic link to make assets (images, files) accessible from the browser

To create the symbolic link, you may use the storage:link command:

php artisan storage

After these steps Exbita should be accessible from http://your-server-ip. If it doesn't, it means you skipped some steps from the guide or did it wrong. Please check carefully again the full guide.