Update Server:
apt update && apt upgrade -y
Set Hostname:
hostnamectl set-hostname invoiceninja.example.com
sudo vim /etc/hosts
update
51.79.66.237 invoiceninja.cabnt-reprsntive.com invoiceninja
Install the required packages:
sudo apt install software-properties-common apt-transport-https ca-certificates gnupg2 vim -y
Install LAMP:
sudo apt install apache2 mariadb-server mariadb-client
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1 libapache2-mod-php8.1
sudo apt install php8.1-{fpm,soap,bcmath,common,imagick,mysql,gmp,curl,intl,mbstring,xmlrpc,gd,xml,cli,zip,bz2}
systemctl status php*-fpm.service
Configure Database:
sudo systemctl enable --now mariadb
sudo mysql_secure_installation
sudo mysql -u root -p
create database invoicedb;
create user invoice@localhost identified by 'your_password';
grant all privileges on invoicedb.* to invoice@localhost;
flush privileges;
exit;
Install Invoice Ninja:
VER=v5.5.40
wget https://github.com/invoiceninja/invoi...
apt install unzip
sudo unzip invoiceninja.zip -d /var/www/html/
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
cd /var/www/html
sudo cp .env.example .env
sudo vim .env
update
APP_URL=//invoiceninja.example.com
DB_CONNECTION=mysql
MULTI_DB_ENABLED=false
DB_HOST=localhost
DB_DATABASE=invoicedb
DB_USERNAME=invoice
DB_PASSWORD=Str0ngPassw0rd123
DB_PORT=3306
sudo chown www-data:www-data /var/www/html/.env
sudo php /var/www/html/artisan key:generate
sudo php /var/www/html/artisan migrate:fresh --seed
Configure Apache:
sudo vim /etc/apache2/sites-available/ninja.conf
paste
i'm replacing angled bracket with square bracket ###
[VirtualHost *:80]
ServerName invoiceninja.example.com
DocumentRoot /var/www/html/public
[Directory /var/www/html/public]
DirectoryIndex index.php
Options +FollowSymLinks
AllowOverride All
Require all granted
[/Directory]
ErrorLog ${APACHE_LOG_DIR}/invoice-ninja.error.log
CustomLog ${APACHE_LOG_DIR}/invoice-ninja.access.log combined
#Include /etc/apache2/conf-available/php8.1-fpm.conf
[/VirtualHost]
sudo a2ensite ninja.conf
sudo a2enmod mpm_event proxy_fcgi setenvif
sudo a2enmod rewrite
sudo a2dissite 000-default.conf
sudo systemctl restart apache2
systemctl status apache2
Enable HTTPS:
sudo apt install python3-certbot-apache -y
certbot --apache -d invoiceninja.example.com
Access Invoice Ninja :
invoiceninja.example.com