Video coming soon…

🔗 Setup Shlink — Self-Hosted URL Shortener

Deploy a professional URL shortener with click analytics, QR codes, custom domains, and a REST API on your own server.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install — Shlink URL shortener running in one command.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/tools/shlink/shlink-ubuntu.sh
chmod +x shlink-ubuntu.sh
sudo bash shlink-ubuntu.sh

Tutorial Steps

1 Download & Run the Installer

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

2 Access Shlink Web Client

Open your browser and navigate to the Shlink web client to manage your short URLs through a graphical interface:

http://<your-server-ip>:8080

3 Create Your First Short URL

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.

4 View Analytics

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.

Ports Used

PortPurpose
8080Shlink HTTP API & Web Client
5432PostgreSQL database (internal)

Overview

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.

Why Use It

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.

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              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.

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    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.

                    When Not to Use It

                    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 Professional Help

                    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.

                      Contact Us

                      Frequently Asked Questions

                      Do I need a custom domain for Shlink?

                      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.

                      How do I create short links in Shlink?

                      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.

                      Can I see where clicks are coming from?

                      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.

                      Does Shlink generate QR codes?

                      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.

                      Can I set links to expire after a certain number of clicks or a date?

                      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.