Serve Shlink with a classic web server

In order to be able to serve shlink, you need to put a web server with PHP integration in front of it.

Both Apache and Nginx are officially supported, but other web servers should work as well.

Here you can find two simple examples of the virtual hosts needed for both Apache and Nginx (you may need to modify them depending on your setup).

Nginx

server {
server_name s.test;
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/php8.2-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}

Apache

<VirtualHost *:80>
ServerName s.test
DocumentRoot "/path/to/shlink/public";
<Directory "/path/to/shlink/public">
Options FollowSymLinks Includes ExecCGI
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>