How to Install FossBilling with Nginx on Ubuntu Linux
Installing FossBilling with Nginx on Ubuntu Linux lets you set up your own system to manage clients and billing.
FossBilling is a free, open-source tool that helps you send invoices and handle customer payments. By installing it on your Ubuntu server, you get full control over your customer information and how your business runs.
This setup uses Nginx, a fast web server, to make FossBilling work. We’ll go through the steps for Ubuntu 22.04 LTS, including setting up Nginx correctly for your billing software and its database.
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. To install it, first update your software list by running:
sudo apt updateThen, install Nginx:
sudo apt install nginx- Open your terminal and update your software list:
sudo apt update - Install Nginx:
sudo apt install nginx
You can 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 your server IP address in a web browser. 
Install MariaDB on Ubuntu Linux
MariaDB is the database FOSSBilling uses to store your billing details securely. To install MariaDB on Ubuntu, first install the repository helper by running `sudo apt install software-properties-common curl`. Next, add the MariaDB repository using a curl command. Finally, install the MariaDB server with `sudo apt install mariadb-server`.
- Install the repository helper:
sudo apt install software-properties-common curl - Add the MariaDB repo:
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash - 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 its own database for storing billing information. First, secure your MariaDB installation by running `sudo mysql_secure_installation` and follow the instructions. Next, log into MariaDB using `sudo mariadb`. You will then 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. Now, create your database:
- Log in:
sudo mariadb - 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 uses PHP (a popular scripting language) to run, and PHP-FPM (FastCGI Process Manager) helps your server communicate with PHP scripts efficiently. Install PHP-FPM and the necessary modules for FOSSBilling with this command:
sudo apt install php-fpm php-mysql php-intl php-curl php-cli php-zip php-common php-mbstring php-xmlThis installs all components needed for FOSSBilling to function with PHP.
Enable it to start automatically: sudo systemctl enable --now php8.3-fpm (Note: you’ll need to replace the asterisk with your specific PHP version, for example `php8.1-fpm`. You can check your installed version by running `php -v`).
General: Configure Nginx
Setting up Nginx correctly is important for FOSSBilling to function properly. First, create a directory for FOSSBilling using `sudo mkdir -p /var/www/fossbilling`. Then, 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
Now, create the configuration file:
sudo nano /etc/nginx/sites-available/fossbilling.conf
Paste your 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
Now it’s time to download FOSSBilling and complete the setup. First, navigate to your temporary directory by running `cd /tmp`. Then, download the latest stable version using `curl https://fossbilling.org/downloads/stable -L –output FOSSBilling.zip`. Unzip the downloaded file into your web directory with `sudo unzip FOSSBilling.zip -d /var/www/fossbilling`. Finally, visit your 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



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


Was this guide helpful?
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.
No comments yet — be the first to share your thoughts!