Install Invoice Ninja on Ubuntu 16.04 VPS with Virtualmin & Nginx

Configure unmanaged VPS with Virtualmin control panel and LEMP stack to host Invoice Ninja, the invoicing & time-tracking software

Invoice Ninja is a software built with PHP Laravel framework. It allows business owners to manage invoices and expenses with ease. Invoice Ninja has both hosted and self-hosted versions of its software. The self-hosted version is open source. This tutorial will guide you through installation of Invoice Ninja on Ubuntu 16.04 VPS with Virtualmin & Nginx.

Invoice Ninja isn’t limited to just invoicing & time-tracking. It packs powerful features like recurring invoices, auto-billing clients, proposals creation, client-side portal, invoices history and much more. Refer to the Invoice Ninja website for full list of features.

By following this Invoice Ninja installation guide, you’ll build your web server with Virtualmin v6.03 GPL, Nginx v1.10.3, PHP v7.0.30 and MariaDB v10.0.36. This guide will always install latest version of Invoice Ninja on your VPS. So let’s get right into it.


You’ll need a VPS with at least 1GB of RAM. You can get one from my recommended VPS providers. This tutorial is only tested on Ubuntu 16.04. But might work on other versions of Ubuntu and Debian. After getting a VPS, you need to complete following steps,

Optional steps can be ignored. But I highly recommend completing them as they are essential to any web application. Once you complete those steps, you can follow below instructions to Install Invoice Ninja on Ubuntu 16.04 VPS.

freelancer to install Invoice Ninja Not a tech guy? Rather have a freelancer install Invoice Ninja for you?
Hire me and have your Invoice Ninja ready within 24 hours!
Get Invoice Ninja Installed

Prepare VPS for Invoice Ninja

Your server should be capable of hosting most PHP applications at this point. But Invoice Ninja has special requirements. It needs PHP’s gmp extension enabled on the server. The Virtualmin installation tutorial doesn’t cover this requirement. Let’s fix that. Execute following command as root user.

apt install php7.0-gmp
Install Composer

Composer is a dependency management tool for PHP. We’ll need it since we’re building Invoice Ninja from Github repository. Following command will install it.

curl -sS -o composer-setup.php
php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Install Invoice Ninja

As I said before, we’re cloning Invoice Ninja from Github repository. This will make sure we’re getting the latest version of software. But before you do that, log out of the root account and login as your domain’s admin user. Then change to home directory.

cd $HOME

Following command will clone Invoice Ninja to your domain’s home directory. It’ll create a directory named invoiceninja in the home directory.

git clone

Navigate to Invoice Ninja directory

cd invoiceninja

Now install Invoice Ninja with Composer,

composer install

Configure Document Root

Virtualmin configure nginx to serve files from public_html directory. But Invoice Ninja serves its public content from its own public directory. As a way around this, we’ll create symlink between public_html directory and Invoice Ninja public directory. Start by removing public_html directory.

rm -rf $HOME/public_html

Create the symlink,

ln -s $HOME/invoiceninja/public $HOME/public_html

This will serve Invoice Ninja public directory content on domain’s public_html directory. We’re almost done. There’s a one last thing we need to take care of.

Configure Nginx for Invoice Ninja

Now we’ll add Nginx rewrite rules for Invoice Ninja. You need to execute these commands as root user. So login to server as root and open Nginx configuration file for the domain with following command.

nano /etc/nginx/sites-available/

Replace with your domain name. Look for following line within the file.

fastcgi_param HTTPS $https;

And paste these rules BELOW that line,

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

Save and close file by hitting Ctrl+X and then Y. Then restart nginx web server,

service nginx restart

Run Invoice Ninja Setup Wizard

Open your domain in the browser to complete the installation. You’ll see a page like below.
Invoice Ninja Setup Wizard

Page has instructions to create a new MySQL database for Invoice Ninja. But you don’t need to do it. Virtualmin already did it for you when you were adding your domain to Virtualmin. You can get MySQL credentials from Virtualmin. Another important setting on setup wizard is Email Settings. I suggest using Mailgun. They have better deliverability in my experience. And there’s a free plan too.

That concludes the instructions to install Invoice Ninja on Ubuntu 16.04 VPS with Virtualmin and Nginx. Create a topic on sysadmin forum if you have issues with the installation.

Show More


Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *