Skip to content
Follow
CMS Ubuntu Linux

How to Install FossBilling with Nginx on Ubuntu Linux

Richard
Written by
Richard
May 1, 2023 Updated Aug 13, 2026 4 min read
How to Install Google Chrome on Ubuntu Linux
How to Install Google Chrome on Ubuntu Linux

FossBilling is a free tool that lets you send invoices and handle customer payments on your own server. Running this platform on Ubuntu 22.04 LTS gives you total ownership of your business data.

This setup uses Nginx, a fast web server, to run FossBilling smoothly. You will also need a database to store your customer details and billing records.

⚡ Quick Answer

Install Nginx and PHP-FPM using `sudo apt install nginx php-fpm php-mysql`. Then, download FOSSBilling, configure Nginx with a site file, and run the web-based setup wizard. Finally, set up the cron job with `sudo crontab -u www-data -e`.

Install Nginx on Ubuntu Linux

Install Nginx on Ubuntu Linux.

Nginx is a fast web server required for FOSSBilling. Update the local package index before pulling down the web server. Run `sudo apt update` followed by `sudo apt install nginx` to get the service running.

🐧Bash / Shell
sudo apt update
🐧Bash / Shell
sudo apt install nginx
  1. Open your terminal and update your software list: sudo apt update
  2. Install Nginx: sudo apt install nginx

Manage the Nginx service with commands like:

  • Stop: sudo systemctl stop nginx
  • Start: sudo systemctl start nginx
  • Enable at startup: sudo systemctl enable nginx

Check if it works by visiting the server IP address in a web browser.

Install Nginx web server on Ubuntu Linux
Install Nginx web server on Ubuntu Linux
The Nginx welcome page should appear. For more detailed guidance, check out the How to install Nginx on Ubuntu guide.

Install MariaDB on Ubuntu Linux

MariaDB is the database FOSSBilling uses to store billing details securely. Run `sudo apt install software-properties-common curl` to add the required repository helper. Next, pull in the MariaDB repository with the official curl command before running `sudo apt install mariadb-server` to install the database server itself.

  1. Install the repository helper: sudo apt install software-properties-common curl
  2. Add the MariaDB repo: curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
  3. Install the server: sudo apt install mariadb-server

Start and enable the service: sudo systemctl enable --now mariadb. For more help, visit How to install MariaDB on Ubuntu Linux.

Create FOSSBilling database

FOSS-Billing requires a dedicated database for storing billing information. First, secure the MariaDB installation by running `sudo mysql_secure_installation` and follow the prompts. Next, log into MariaDB using `sudo mariadb`. Create a database named `fossdb` and a user named `fossdbuser`, granting `fossdbuser` the necessary permissions for `fossdb`.

sudo mysql_secure_installation

Follow the on-screen prompts. Create the database with these steps:

  1. Log in: sudo mariadb
  2. Run these commands:
    CREATE DATABASE fossdb;
    CREATE USER fossdbuser@localhost IDENTIFIED BY 'your_password';
    GRANT ALL ON fossdb.* TO fossdbuser@localhost WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    exit

Install PHP-FPM on Ubuntu Linux

FOSSBilling relies on PHP to run code on the server. PHP-FPM (FastCGI Process Manager) handles incoming requests so those scripts execute smoothly. Install PHP-FPM and the necessary modules for FOSSBilling with this command:

🐧Bash / Shell
sudo apt install php-fpm php-mysql php-intl php-curl php-cli php-zip php-common php-mbstring php-xml

This installs all components required for FOSSBilling to function with PHP.

Enable it to start automatically: sudo systemctl enable --now php8.3-fpm (Note: replace the version number with the specific PHP version installed, for example `php8.1-fpm`. Check the installed version by running `php -v`).

General: Configure Nginx

Setting up Nginx correctly matters for FOSSBilling to function properly. First, create a directory for FOSSBilling using `sudo mkdir -p /var/www/fossbilling`. Set the correct ownership for this directory, which is typically `www-data:www-data` for web servers, using `sudo chown -R www-data:www-data /var/www/fossbilling`. After that, create the Nginx configuration file for FOSSBilling at `/etc/nginx/sites-available/fossbilling.conf`.

sudo mkdir -p /var/www/fossbilling
sudo chown -R www-data:www-data /var/www/fossbilling

Create the configuration file:

sudo nano /etc/nginx/sites-available/fossbilling.conf

Paste the server settings into the Nginx configuration file, save it, and then enable the new Nginx configuration for FossBilling by reloading Nginx.

sudo ln -s /etc/nginx/sites-available/fossbilling.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Download and Setup

Download FOSSBilling and complete the setup. Navigate to the temporary directory by running `cd /tmp`. Pull down the latest stable version using `curl https://fossbilling.org/downloads/stable -L --output FOSSBilling.zip`. Unzip the downloaded archive into the web directory with `sudo unzip FOSSBilling.zip -d /var/www/fossbilling`. Finally, visit the domain in a web browser to follow the setup wizard.

cd /tmp
curl https://fossbilling.org/downloads/stable -L --output FOSSBilling.zip
sudo unzip FOSSBilling.zip -d /var/www/fossbilling

Visit the domain in a browser.

FOSSBilling setup wizard on Ubuntu Linux
FOSSBilling setup wizard on Ubuntu Linux
Follow the setup wizard to connect the database (
Entering database information in FOSSBilling setup
Entering database information in FOSSBilling setup
) and create an admin account (
Creating admin account in FOSSBilling on Ubuntu
Creating admin account in FOSSBilling on Ubuntu
). Remove the installation folder for security:

sudo rm -rf /var/www/fossbilling/install

Set up the background task (cron job):

sudo crontab -u www-data -e

Add this line: */5 * * * * php /var/www/fossbilling/cron.php

Completing FOSSBilling setup on Ubuntu Linux
Completing FOSSBilling setup on Ubuntu Linux
Log in to the dashboard.
FOSSBilling dashboard interface on Ubuntu Linux
FOSSBilling dashboard interface on Ubuntu Linux
For SSL setup, see How to setup Let's Encrypt with Nginx web server.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install Nginx on Ubuntu Linux
Ubuntu Linux How to Install Nginx on Ubuntu Linux
How to Install Monica CRM on Ubuntu with Nginx
CMS How to Install Monica CRM on Ubuntu with Nginx
How to Install FreeScout with Nginx on Ubuntu Linux
CMS How to Install FreeScout with Nginx on Ubuntu Linux
How to Install JasperReports Server on Ubuntu Linux
CMS How to Install JasperReports Server on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

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