# shlink

A self-hosted URL shortener.

# Run docker instance

docker run \
    --name my_shlink \
    -p 8080:8080 \
    -e DEFAULT_DOMAIN=s.test \
    -e IS_HTTPS_ENABLED=true \
    -e GEOLITE_LICENSE_KEY=xyz123 \
    shlinkio/shlink:stable
  • --name - can be whatever
  • DEFAULT_DOMAIN - set to yourdomain.com
  • IS_HTTPS_ENABLED - enable for HTTPS support (automatic via LetsEncrypt)
  • GEOLITE_LICENSE_KEY - optional - read about it here. You can exclude this setting if you don't want to geolocate where your link clicks are coming from.

# Enable HTTPS using Caddy

Use a Caddyfile such as:

yourdomain.com {
    reverse_proxy http://127.0.0.1:8080
}

Then run it:

./caddy run --config ./Caddyfile

# Generate an API key via docker

sudo docker exec -it my_shlink shlink api-key:generate

Write it down!

# Install Web client to interact with shlink

  • Download from here
  • Unzip the zip

# Run the Shlink Web portal to manage your instance

Using something like Caddy where /home/www/ is where the shlink Web interface is unzipped:

sudo caddy file-server \
  --root /home/www \
  --listen :8888

#