EZ Encryption Middleware Tutorial (Basic + Advanced)
This tutorial uses the middleware and V2Board admin backend on the same server (BT Panel) as an example. If your backend and middleware are on different servers, the approach is similar.
1. Beginners: Download the Release Build (Recommended)
No need to install the Go environment; just use the pre-compiled binary provided by the author.
1. Download the Release Build (AMD64 Example)
# Switch to the root directory
cd /root
# Grant execute permission; ez-api is the executable filename, you can change it freely
chmod 777 ez-api
⚠️ Note: If your server is ARM architecture, select the corresponding
arm64version on the Release page.
2. Configure the .env File
Enter the directory and edit the configuration file:
nano .env
Reference configuration:
# 1. Basic Server Settings
PORT=3939 # Middleware listening port
BACKEND_API_URL=https://api.xxx.com # Backend real API root URL (without /api/v1, no trailing slash)
PATH_PREFIX=/ez/ez # Path prefix; leave empty "" to handle all requests
# 2. CORS / Security Settings
CORS_ORIGIN=* # Allowed CORS origin
ALLOWED_ORIGINS=* # Request source whitelist
REQUEST_TIMEOUT=30000 # Request timeout (ms)
ENABLE_LOGGING=false # Whether to output request logs
DEBUG_MODE=false # Whether to output debug logs
# 3. Payment Callback Bypass Paths (Optional)
ALLOWED_PAYMENT_NOTIFY_PATHS=
# 4. AES Encryption/Decryption Configuration
AES_KEY=4c6f8e5f9467dc71 # Must match the frontend (16-character hex string)
3. BT Panel Process Guardian Manager
Add a process guardian to keep the middleware running persistently:
# Name
ez-api
# Run User
root
# Process directory
/root/
# Start command
/root/ez-api
BT Panel Process Guardian Manager
4. BT Panel Reverse Proxy
Create a new site (domain like ez.api), point it to your VPS, and configure the reverse proxy:
Target URL: http://127.0.0.1:3939
And apply for an SSL certificate.
Add Static Site
Set Reverse Proxy
5. Modify Frontend Configuration /src/config/index.js
API_MIDDLEWARE_URL: "https://ez.api"
API_MIDDLEWARE_KEY: "4c6f8e5f9467dc71"
Modify Frontend Configuration File