Shlink is a web application built with PHP. It shouldn't be hard to install, but you have to follow these steps.


  • PHP 7.1 or greater with JSON, APCu, intl, curl, PDO and gd extensions enabled.
  • MySQL, PostgreSQL or SQLite.
  • The web server of your choice with PHP integration (Apache or Nginx recommended).

Installation steps

  • Download the latest distributable file and decompress it at the location of your choice
  • Create an empty database (not necessary if you are going to use SQLite).
  • Setup the application by running the bin/install script. It will guide you through the installation process.
  • Recursively grant write permissions to the data directory.
  • Optionally, you can create a symlink to the bin/cli script in a folder which is in your path.
    For example /usr/local/bin for linux systems. This will allow you to easily run shlink from anywhere in the command line.
  • Generate your first API key by running bin/cli api-key:generate. You will need the key in order to interact with shlink's API.
  • Finally access to and configure your server to start creating short URLs.

Virtual hosts

These are samples for the most used web servers. Use them to get shlink up and running.

                        server {
    listen 80;
    root /path/to/shlink/public;
    index index.php;
    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;

    location ~ /\.ht {
        deny all;
                        <VirtualHost *:80>
    DocumentRoot "/path/to/shlink/public"

    <Directory "/path/to/shlink/public">
        Options FollowSymLinks Includes ExecCGI
        AllowOverride all
        Order allow,deny
        Allow from all

Long-running tasks

Resolving the IP of a visitor in order to get its location involves performing a request to an external service, which gets time. For this reason, this task is not done in real time.

You can manually run the command visit:process which will process all the IPs from visits.

Alternatively, you could create an scheduled task which automatically runs that command so that the information is updated periodically.

This is an example cron job that could be created under a Unix system. It will run the command every hour, processing all pending IP addresses:

0 * * * * /path/to/shlink/bin/cli visit:process -q

Something similar happens with page previews. Shlink is capable of generating the preview of a page behind a short code by appending the /preview path to a short URL. For example,

If you access that URL, the image will be generated and cached, but the first time, the request will take a little bit more time.

In order to prevent this, you can use the command shortcode:process-previews, which will generate all missing previews so that any later web request is faster

This command can be configured for a cron job too:

30 * * * * /path/to/shlink/bin/cli shortcode:process-previews -q