Introduction
In this guide, we’ll walk you through the process of setting up FOSSBilling on your VPS using Docker and Nginx Proxy Manager for reverse proxying. We will also cover setting up SSL with Let’s Encrypt to secure your domain, ensuring that your billing platform is both efficient and secure.
By the end of this tutorial, you’ll have a fully-functional FOSSBilling setup accessible via a custom domain over HTTPS.
Prerequisites
Before you begin, ensure you have the following:
- A VPS running Ubuntu 24 (or a similar version).
- Docker and Docker Compose installed.
- Nginx Proxy Manager installed and running on your server.
- A domain (e.g.,
billing.yourdomain.com) that points to your VPS IP address.
Step 1: Install and Configure FOSSBilling with Docker
If you haven’t already, follow these steps to get FOSSBilling running using Docker:
Create a directory for FOSSBilling:
Create the Docker Compose file:
Add the following content, making sure to adjust the database password if necessary:
Start the containers:
Verify if the containers are running:
Once the containers are running, you can access FOSSBilling via http://your-server-ip:8080.
During the FOSSBilling installation, when it asks for the MySQL connection information, you should enter the following values:
- Database hostname:
db(This is the name of the MariaDB service in your Docker Compose file) - Database port:
3306(This is the default port for MySQL/MariaDB) - Database name:
fossbilling(As defined in your Docker Compose file) - Database username:
fossbilling(As defined in your Docker Compose file) - Database password:
fossbillingpass(As defined in your Docker Compose file)
So, the information to enter would be:
- Database hostname:
db - Database port:
3306 - Database name:
fossbilling - Database username:
fossbilling - Database password:
fossbillingpass 
Great to hear that the installation is complete! 🎉 Here’s how to complete the remaining setup tasks:
1) Remove the Installer
You need to delete the
installfolder to complete the installation process. Run the following command:This ensures that the installer folder is removed for security reasons.
2) Configuration Permission
To make the
config.phpfile read-only, which is important for security, run:This ensures that the configuration file is protected from unwanted changes.
3) Set Up Cron Job
You need to set up a cron job to ensure FOSSBilling runs scheduled tasks every 5 minutes. To do this:
Open the crontab editor:
Add the following line at the end of the file:
This command will execute
cron.phpevery 5 minutes. Save the file and exit the editor.With these steps completed, FOSSBilling should be fully configured and ready to use! You can log into the admin panel at
http://your-server-ip:8080/adminand start using the application.
Step 2: Set Up Nginx Proxy Manager for FOSSBilling
Since Nginx Proxy Manager simplifies the process of managing reverse proxies, follow these steps:
Log into Nginx Proxy Manager at
http://your-server-ip:81using your credentials.Go to the Proxy Hosts tab and click Add Proxy Host.
In the Add Proxy Host form, enter the following:
- Domain Names:
billing.yourwebsite.com(your domain) - Scheme:
http - Forward Hostname/IP:
localhost - Forward Port:
8080 - Block Common Exploits: Check this box.
- Domain Names:
Enable SSL by selecting Enable SSL and choosing Request a new SSL Certificate from Let’s Encrypt. Ensure you enable Force SSL for HTTPS redirection.
Save the settings.
After saving, your FOSSBilling instance will be accessible at https://billing.yourwebsite.com.
Step 3: Set Up Automated SSL Renewal
To ensure your SSL certificate from Let’s Encrypt remains valid, Nginx Proxy Manager handles the automatic renewal. However, it’s always good to double-check:
- Go to SSL Certificates in Nginx Proxy Manager.
- Confirm that your certificate is renewed automatically.
Step 4: Configure Backups for FOSSBilling
Setting up regular backups for your database and FOSSBilling files is crucial for data protection. You can do this with a simple bash script and cron job:
Create a backup script:
Add the following content to back up your database and files:
Make the script executable:
Schedule the backup using cron:
Add the following line to back up every day at 2 AM:
Step 5: Optimize Performance
For better performance, you can optimize MariaDB and enable PHP caching:
Edit MariaDB configuration for better performance:
Adjust settings like
innodb_buffer_pool_sizeandmax_connections.Enable PHP caching (OPcache) for improved performance:
Install OPcache:
Enable it by modifying
/etc/php/7.x/fpm/php.iniand uncommenting:Restart PHP-FPM:
Conclusion
With these steps, you’ve successfully set up FOSSBilling with Docker, configured it with Nginx Proxy Manager, secured it with SSL, and implemented backups and performance optimizations. You’re now ready to manage your billing platform securely and efficiently.

