📚 About
The point of this project is a production ready solution for running WHMCS in docker under Traefik reverse proxy. There's already a couple other projects attempting something similar. However, they are either meant for development only, are outdated and/or not optimized to be ran under Traefik. This project complies with all of the official WHMCS security and packages recommendations that are found at "Further Security Steps" and "System Environment Guide".
🧰 Getting Started
This project uses Nginx instead of Apache web server, WHMCS was development with Apache in mind so few extra steps are required to achieve production ready setup. Majority of modifications have been already implemented, rest of manual modifications are covered in the guide below.
Requirements
- Domain
- Valid WHMCS license
🏗️ Installation
Clone repository
git clone https://github.com/EdyTheCow/docker-whmcs.git
Set correct acme.json permissions
Navigate to _base/data/traefik/ and run
sudo chmod 600 acme.json
Generate .htpasswd user and pass
Navigate to _base/data/traefik/.htpasswd and place your generated user/pass in there
Whenever you navigate to your admin area, you'll have to login with generate user and pass and then login with your WHMCS user. This basic auth is very effective against bots and endless spam in emails of failed logins.
Start docker compose
Inside of _base/compose run
docker-compose up -d
Configure Nginx default.conf
Navigate to whmcs/data/nginx/sites/default.conf and change these variable:
| Variable | Example | Description |
|---|---|---|
| YOUR_DOMAIN | portal.domain.com | Domain for WHMCS installtation |
| YOUR_TRAEFIK_IP | 172.17.0.0/16 | It's normally 172.17.x.x or 172.18.x.x you can find it by running docker inspect on the traefik container |
| IP_OF_YOUR_SERVER | Public IP of the server | This is used to verify the WHMCS license |
Place contents of WHMCS files
Navigate to whmcs/data/whmcs and place the contents of WHMCS in there
Set .env variables for WHMCS
Navigate to whmcs/compose/.env and set these variables:
| Variable | Example | Description |
|---|---|---|
| DOMAIN | portal.domain.com | Domain for WHMCS installtation |
| MYSQL_PASSWORD | MySQL user password | Generate a password for your mysql user |
| MYSQL_ROOT_PASSWORD | MySQL root password | Do not use the same password, generate a new one |
Start docker compose
Inside of whmcs/compose run
docker-compose up -d
Now you can navigate to your-domain.com/install and follow the installation insturctions. Use mysql for MySQL host. User, database and password are found in whmcs/compose/.env where you configured them earlier.
After installation delete the install folder in whmcs/data/whmcs/install and follow the instruction below for additional configuration for security hardening.
🔒 Security Hardening
Moving Files Above Web Root
File Storage
Templates Cache
Crons Directory
Changing Configuration Permissions
Setting update folder
TODO: https://help.whmcs.com/m/updating/l/678178-configuring-the-temporary-path
🐛 Known issues
📜 Credits
- Logo created by Wob - Dribbble.com/wob
- Inspired by other similar projects fauzie/docker-whmcs, cloudlinux/kd-whmcs and darthsoup/docker-whmcs
