Installing on Apache2 or OpenLiteSpeed

The documentation I could find for installing InvoiceNinja on a self-hosted server running Apache2 or OpenLiteSpeed is well out of date, but it’s not too difficult so I thought I would share how I did it on both, running on Ubuntu 22.04 LTS.

  1. Create a normal empty site using your usual control panel. I used Virtualmin but there are lots of ways of achieving this. In my case the site was created in /home/[username] with a default index.html file in folder public_html. (There’s a tutorial about this and about replacing Apache2 with OpenLiteSpeed at if that helps.)

  2. Add DNS records pointing to this server as usual. Use Letsencrypt to generate an SSL certificate as usual. Make sure you can see the default index.html page in a browser.

  3. Rename the public_html folder to just public if it’s not already called that. (It’s possible to get InvoiceNinja to work in public_html but that involves a lot more work, this way is easier.)

3a (OpenLiteSpeed only). I already had other sites on the same server using public_html, so I made a new VHost Template with General > Base 2 > Document Root set to $VH_ROOT/public/ and added the site to that.

3b (Apache2 only). Edit /etc/apache2/sites-available/[your domain].conf and replace all instances of “public_html” with just “public” (four locations in my case). Restart apache.

Check that the test page (now in /public) still loads from a browser.

  1. Create a temporary folder in the root of the site (next to /public), upload the latest version of InvoiceNinja to that folder and unzip it. Set the owner and permissions to match the rest of the folders. Move all files up one level from the temporary folder. Delete the (now empty) temp folder and the (now unnecessary) zip file. Also delete the temporary index.html from /public if it’s still there.

(You could unzip the files directly to the root folder above /public but I found it easier to set the ownership and permissions on a temp folder this way first.)

  1. Install composer. This step was missing from most of the tutorials I found. It needs to be done as root.

sudo apt install composer

  1. Run the following commands, as listed in These need to be run in the root folder (above /public) as the owner of the web site (in my case [username], on some servers it will be “www-data” or “nobody”). If you don’t do this you will see a “Server 500” error.

cp .env.example .env
composer i -o --no-dev
php artisan key:generate

  1. Restart OpenLiteSpeed so it picks up the changes to .htaccess. If you don’t do this you will see a 404 error.

  2. Point your browser at https://[your domain} and voila! The installer should appear. From there everything is the same as when running on nginx.

  3. You will need to add cron jobs, which aren’t mentioned in but are described here
    Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja

Edited to add:

  1. Click the “About” link at the bottom left of the dashboard (an ‘i’ in a circle) then HEALTH CHECK to see if more adjustments to your environment are necessary. I had to increase the memory limit and install snappdf and “headless chrome” to clear the warnings and get updates working. Also performance will be very poor unless the supervisor cron job is running.
1 Like


Thanks for sharing!

If anybody wonders how to use Invoiceninja in a Docker container with Apache2, here are the options you must use in your Apache2 Vhost (in addition to the standard options!)

# redirect everything which is no real file/directory
FallBackResource /index.php

# pass all requests to PHP files to the Docker container
ProxyPassMatch "^/(.*\.php(\?.*)?)$" "fcgi://$1"
1 Like