Deploy a professional URL shortener with click analytics, QR codes, custom domains, and a REST API on your own server.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/tools/shlink/shlink-ubuntu.sh
chmod +x shlink-ubuntu.sh
sudo bash shlink-ubuntu.sh
The script installs Docker if needed, pulls Shlink and PostgreSQL images, configures the database, and starts both containers. Shlink will be available on port 8080 with a PostgreSQL backend for reliable data storage.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/tools/shlink/shlink-ubuntu.sh
chmod +x shlink-ubuntu.sh
sudo bash shlink-ubuntu.sh
Open your browser and navigate to the Shlink web client to manage your short URLs through a graphical interface:
http://<your-server-ip>:8080
In the Shlink web client, click "Create short URL" and paste your long URL. Optionally set a custom slug for a memorable short link, configure an expiry date, set a maximum number of visits, and add tags for organization. Click "Save" to generate your short URL.
Click on any short URL in the dashboard to view detailed analytics: click count over time, top referrers, device types, operating systems, browsers, and geographic data broken down by country and city. All data is stored locally — no third-party services involved.
| Port | Purpose |
|---|---|
| 8080 | Shlink HTTP API & Web Client |
| 5432 | PostgreSQL database (internal) |
Shlink is a self-hosted URL shortener that provides detailed click analytics, geolocation tracking, QR code generation, and a REST API. It supports multiple domains, custom slugs, link expiration, and bot traffic filtering — giving you full ownership of your branded short links.
Unlike Bitly or TinyURL, Shlink runs on your own domain and infrastructure. You control the data, set custom short slugs, track detailed analytics including device and country breakdown, and have no link limits or monthly fees.
Shlink listens on port 8080. Always place it behind a reverse proxy on port 443 with a custom domain. The raw port 8080 should not be exposed publicly — all public traffic should go through your reverse proxy.
Alternatives include Bitly (cloud, limited free tier), YOURLS (PHP-based self-hosted), Kutt (self-hosted, simpler), and Dub.co (cloud with analytics). Choose Shlink for robust API access, detailed analytics, and multi-domain support on your own server.
Avoid Shlink if you just need a simple URL shortener without analytics — YOURLS or Kutt are lighter. Also avoid if you cannot set up a custom domain, as an IP-based short URL defeats the purpose.
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Technically no, but practically yes. Short URLs made with an IP address like http://1.2.3.4/abc are not actually shorter than the original URL in most cases. Shlink is designed to work with a short custom domain like go.yourdomain.com configured via a reverse proxy.
You can create short links via three methods: the REST API (most powerful), the Shlink Web Client (a separate optional web UI you self-host or use from the official hosted version), or the Shlink CLI tool inside the container. All methods require an API key generated on first setup.
Yes. Shlink tracks detailed analytics for each short link including total clicks, unique clicks, click timeline, referring domains, operating systems, browsers, and geographic location by country and city. All data is stored in your own database.
Yes. Every short URL in Shlink has a corresponding QR code available at the URL with /qr-code appended. The QR code is generated on demand and can be customized in size and format. Use these for printed materials, signs, or product packaging.
Yes. When creating a short URL via API or the web client, you can set an expiration date after which the link returns a 404, and a maximum number of visits after which the link stops working. This is useful for time-limited promotions.