YJK

独立世界

Independent World
twitter
telegram

Self-built Shlink | A URL shortening program

Q: Explain why you need to build your own URL shortening service.

A: The main purpose of building your own URL shortening service is to make it convenient for users to access long URLs. By shortening long URLs, users can remember and share shorter URLs, making it easier and faster to access the target page. In addition, building your own URL shortening service can also improve the security of the website, as shortened URLs can hide the real address of the target URL, preventing hackers from using the real address for attacks. Furthermore, using shortened URLs can also help websites better manage links and track traffic sources.

The following tutorial is about building a free URL shortening service on Northflank.

0/ Pre#

1/ Setup#

Create a free Project

e81b6635d254c906d279c398570db94d.png

Create a database

1e38b58aa6d3bf66b3c28318d368e2fb.png

After successful creation, record the connection information for later use.

7438f799e3640a4a405b18c854645dff.png

Create a service

17415e2e03d9ddf09d373a2a8a68f40e.png

e22cdc5aca1ea927f7b00183fa789c9d.png

Enter shlinkio/shlink:stable in the Image path field.

Fill in the Environment variables according to the following content:

DEFAULT_DOMAIN="long.ee"
IS_HTTPS_ENABLED="true"
DB_DRIVER="postgres"
DB_HOST=""
DB_PASSWORD=""
DB_USER=""
DB_NAME=""
GEOLITE_LICENSE_KEY=""

In the above, fill in your own domain for DEFAULT_DOMAIN, and fill in the information recorded in the previous step for DB_, and fill in the information recorded in step 0 for GEOLITE_LICENSE_KEY.

ab3146d9c775a6958d5d038138ed6574.png

Click on create.

Bind a domain

edec73f67139c61feeb9d765f7d63927.png

Then follow the instructions to create a TXT record to verify the domain and create a CNAME record to bind the domain.

Create an API

7561e7132cb726e1e5c70bcd00f9ef67.png

Enter shlink api-key:generate to create an API Key.

687bea2b249f3cf3bb17dc18feb75cd5.png

2/ Usage#

Go to the Shlink Web APP:

Click on Add a server and enter the name, backend address, and API Key to create and use it.

8019d143b2de82da1e9332ee3e5b3547.png

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.