【FOSSBilling】開源免費的主機計費管理工具,取代付費的WHMCS

繼去年度所有的網站都轉移到HestiaCP主機後,隨著管理的網站越來越多就發現不是某台伺服器儲值到期金用盡、不然就是網域到期無續約到,造成服務中斷。
所以原先要導入WHMCS來實現自動開通主機和付款問題,但是轉念一想身為工程師既然VPS管理工具都採用開源系統了,那WHMCS是不是也有開源版呢?

透過連假期間找到了FOSSBilling 這套工具,重點安裝簡單,還支援繁體中文。

FOSSBilling安裝

目前FOSSBilling 有正式版和開發預覽版,這邊用的是v0.3.0的正式版
https://fossbilling.org/downloads

安裝程式下載後,我們一樣直接上傳到指定目錄

接著先把資料庫建立好

上面都好了之後,輸入網址就會來到下面的畫面。
只要確認下面的設定都呈現綠色的,直接點擊NEXT

將前面設定好的資料庫帳密填入,點擊NEXT

這邊是設定管理員基本資料,後面登入時會用到。
貨幣的部分你可以選擇預設的 USD ,這邊我是改成新台幣
設定完成後,點擊NEXT

這時會跳出彈窗警告,點擊確定就好

看到著個畫面代表安裝完成了。
如果你使用的是apache就可以開始使用了,而nginx則需要調整規則。

Nginx設定

這邊是使用HestiaCP所以設定上可以參考下面的設定。
當然官方也有提供配置工具 https://config.fossbilling.org/

server {
    listen      123.456.789.01:443 ssl http2;
    server_name Fossbilling.org ;
    set $root_path   '/home/admin/web/Fossbilling.org/public_html';
    index       index.php index.html index.htm;
root $root_path;
try_files $uri $uri/ @rewrite;
    sendfile off;
include /etc/nginx/mime.types;

    access_log  /var/log/nginx/domains/Fossbilling.org.log combined;
    access_log  /var/log/nginx/domains/Fossbilling.org.bytes bytes;
    error_log   /var/log/nginx/domains/Fossbilling.org.error.log error;

    ssl_certificate      /home/admin/conf/web/Fossbilling.org/ssl/billing.go>
    ssl_certificate_key  /home/admin/conf/web/Fossbilling.org/ssl/billing.go>
    ssl_stapling on;
    ssl_stapling_verify on;

    include /home/admin/conf/web/Fossbilling.org/nginx.hsts.conf*;


   # Block access to sensitive files and return 404 to make it indistinguishabl>
    location ~* .(ini|sh|inc|bak|twig|sql)$ {
        return 404;
    }

    # Block access to hidden files except .well-known
    location ~ /\.(?!well-known\/) {
        return 404;
    }

    # Disable PHP execution in /uploads
    location ~* /uploads/.*\.php$ {
        return 404;
    }
# Deny access to /data
    location ~* /data/ {
        return 404;
    }

    location @rewrite {
        rewrite ^/page/(.*)$ /index.php?_url=/custompages/$1;
        rewrite ^/(.*)$ /index.php?_url=/$1;
    }

    location ~ \.php {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        # fastcgi_pass need to be changed according your server setup:
        # phpx.x is your server setup
        # examples: /var/run/phpx.x-fpm.sock, /var/run/php/phpx.x-fpm.sock or />
        # Or even localhost:port (Default 9000 will work fine) 
        # Please check your server setup

        fastcgi_pass    unix:/run/php/php8.1-fpm-Fossbilling.org.sock;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
            include     /home/admin/conf/web/Fossbilling.org/nginx.fastcgi_c>



        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;

        include fastcgi_params;
    }

    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root $root_path;
        expires off;
    }
  location /error/ {
        alias   /home/admin/web/Fossbilling.org/document_errors/;
    }

    location ~ /\.(?!well-known\/) {
       deny all;
       return 404;
    }
    location /vstats/ {
        alias   /home/admin/web/Fossbilling.org/stats/;
        include /home/admin/web/Fossbilling.org/stats/auth.conf*;
    }

    proxy_hide_header Upgrade;

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /home/admin/conf/web/Fossbilling.org/nginx.ssl.conf_*;
}

客戶端畫面

一般客戶端畫面只需要輸入網址就可以看到了,右上角可以選擇語系。
在登入前記得要先註冊會員,才能進行登入。

後臺管理畫面

管理員登入位置不太一樣,是 在網址後加上/admin
登入時所需的Email和密碼是前面安裝時所填寫的資料。

關於作者 碼農Roy

曾經北漂的工程師,現在專注於.Net Core、WordPress開發


發佈留言