Deploy a Private Short‑URL Service in Minutes with Docker or Binary
This guide walks you through the reasons for a self‑hosted short‑URL system, the required environment, and step‑by‑step deployment using Docker containers or a standalone binary, plus Nginx reverse‑proxy configuration for production stability and security.
Why a Private Short‑URL Service?
Using third‑party short‑link providers can expose user behavior data, create reliability risks if the external service fails, limit custom integration, and incur high subscription costs. A self‑hosted solution gives full control over data, improves brand image with a custom domain, and enables precise tracking of marketing channel performance.
Prerequisites for Production
Operating System : Linux (CentOS 7+ or Ubuntu 18.04+ recommended)
Database : MySQL 5.7+ (stores URL mappings and statistics)
Cache : Redis 6.0+ (accelerates high‑frequency lookups)
Web Server : Nginx (acts as reverse proxy and SSL terminator)
Domain : A DNS‑resolvable domain for accessing short links
Method 1 – Docker Container Deployment (Recommended)
Follow these five steps if you are familiar with Docker:
mkdir dwz-admin
cd dwz-adminCreate a docker-compose.yml defining the service, ports, and volume mounts:
services:
dwz-server:
container_name: dwz-server
image: docker.cnb.cool/mliev/open/dwz-server:latest
restart: always
ports:
- "8080:8080"
volumes:
- "./config/:/app/config/"
environment:
- TZ=Asia/Shanghai
- GIN_MODE=releasePrepare the configuration directory and set permissions:
mkdir -p config
chmod 666 ./configStart the service: docker-compose up -d Access the management UI at http://localhost:8080 to complete initialization.
Method 2 – Standalone Binary Deployment (No External Dependencies)
For environments without Docker, download and run the pre‑compiled binary:
# Create project directory
mkdir mliev-dwz
cd mliev-dwz
# Download latest Linux x86_64 release
wget https://github.com/muleiwu/dwz-server/releases/latest/download/dwz-server_Linux_x86_64.tar.gz
tar -xzf dwz-server_Linux_x86_64.tar.gz
chmod +x dwz-serverStart the server directly or in the background:
# Direct start
./dwz-server
# Background run
nohup ./dwz-server > dwz.log 2>&1 &This mode requires only the binary, making it suitable for low‑resource servers.
Configure Nginx as a Reverse Proxy
Install Nginx on your host:
# Ubuntu/Debian
sudo apt update
sudo apt install nginx
# CentOS/RHEL
sudo yum install epel-release
sudo yum install nginxCreate /etc/nginx/conf.d/dwz.conf (replace t.xlsys.net with your domain):
server {
listen 80;
server_name t.xlsys.net;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
proxy_redirect off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
}Test the configuration and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx # or sudo nginx -s reloadWith Nginx in front, the short‑URL service gains better performance, security, and the ability to serve HTTPS.
Conclusion
Deploying a private short‑URL platform like dwz‑server empowers operations teams to solve real business pain points—reducing SMS length, protecting data, ensuring service continuity, and enhancing brand perception—while keeping costs low and implementation simple.
Project repository: https://github.com/muleiwu/dwz-server
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Xiao Liu Lab
An operations lab passionate about server tinkering 🔬 Sharing automation scripts, high-availability architecture, alert optimization, and incident reviews. Using technology to reduce overtime and experience to avoid major pitfalls. Follow me for easier, more reliable operations!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
