Skip to content

AliRn76/shortener

Repository files navigation

What is URL Shortener?

URL shortening is a technique on the World Wide Web in which a Uniform Resource Locator may be made substantially shorter and still direct to the required page. This is achieved by using a redirect which links to the web page that has a long URL.

How to use this image

Simple usage:

docker run --name shortener -d alirn76/url-shortener:latest

Options:

Publish:

The instance starts at port 8000, so you can publish it in any port you want.

WORKER:

Default is 2

The instance starts with how many workers?

BASE_URL:

Default is http://127.0.0.1:8000

Usage:

    1. Show the Shortened URL for copy
    1. Check the Original URL if PRIVATE is true

PRIVATE:

Default is false

Check the BASE_URL in Original URL

It won't work correctly if BASE_URL is ip

example:

BASE_URL = https://alirn.ir

TITLE:

Default is "URL Shortener"

Used to show the Title of page (you can put your website name in it)

DESCRIPTION:

Default is "Create Short & Memorable URL In a Seconds."

Full-featured usage:

docker run --name shortener --restart always -p 80:8000 -e WORKER=1 -e BASE_URL=https://example.com -e PRIVATE=true -e TITLE="URL Shortener" -e DESCRIPTION="Create Your Short URL Here" -d alirn76/url-shortener:latest

Persistent Storage:

Known Issue: You'll get 5xx error if you don't create a docker volume.

    1. Create docker volume → docker volume create shortener-volume
    1. Add volume to you run command → --volume shortener-volume:/shortener/database

Demo:

demo

Thanks to MohammadReza Shahbazi for Frontend