How to Install FossBilling with Nginx on Ubuntu Linux
FossBilling is an open-source client management and billing software that lets you run your online business and handle customer invoices in one place. Setting up FossBilling on Ubuntu 22.04 LTS requires the Nginx web server, PHP, and a MariaDB database to store your records safely.
This configuration connects Nginx with PHP-FPM to serve your billing panel quickly. You need root access to your Ubuntu server and a domain name pointed at your server IP address before you start.
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
To install Nginx on Ubuntu Linux for your FOSSBilling installation Ubuntu setup, you need to update your local software list and use the apt package manager. Open your terminal and run the standard update command first, then install the web server package directly to get the Nginx service running on your server.
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.
sudo apt update
sudo apt install nginx
- Open your terminal and update your software list:
sudo apt update - 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 MariaDB on Ubuntu Linux
MariaDB provides the relational database needed for your FOSSBilling installation Ubuntu environment to store customer and billing details securely. You can set this up by installing the necessary repository helper tools, pulling the official MariaDB package repository, and running the standard package installation command in your terminal.
- 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
Creating a dedicated database and user account is a required step for your FOSSBilling installation Ubuntu process. You must secure your database server, log into the MariaDB command prompt, and run SQL commands to set up a new database and a dedicated user with full permissions for that database.
sudo mysql_secure_installation
Follow the on-screen prompts. Create the database with these steps:
- 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
PHP-FPM (FastCGI Process Manager) handles incoming dynamic requests so your application scripts execute smoothly during your FOSSBilling installation Ubuntu setup. You need to install PHP-FPM along with several essential PHP modules like MySQL, curl, and mbstring to ensure the billing software functions without errors.
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
Configuring Nginx correctly is essential for your FOSSBilling installation Ubuntu configuration to serve web traffic properly. You need to create a dedicated web directory, assign the correct user ownership to that folder, and set up a custom server block configuration file so Nginx can process PHP requests.
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
Downloading the application files and running the web-based installer finishes your FOSSBilling installation Ubuntu configuration. You will pull down the latest stable archive directly from the official project source using curl, extract the files into your web server directory, and open your web browser to finish 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. 


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!