Debian 10 Nginx SSL and YOURLS get me 404 on shorted links

Describe the Bug
I installed YOURLS today on a Ubuntu 20.04 machine with the domain routed through Cloudflare.
I can’t access the Admin Panel, I only get a white page.
I used the Gudies for Ubuntu 20.04 and Nginx + LE from the website.


  • OS: Ubuntu 20.04.2 LTS
  • Browser: Firefox 86.0b9 (64-bit)
  • Webserver: Nginx 1.18.0 (ubuntu)
  • PHP: PHP 7.4.3
  • MySQL: MariaDB 10.3.27
  • YOURLS: 1.7.9


server {
  listen 80;
  listen [::]:80;
  server_name domain.tld;
  return 301 https://$host$request_uri;

server {
  listen 443 http2 ssl;
  listen [::]:443 http2 ssl;

  server_name domain.tld;

  ssl_certificate /etc/ssl/live/yourls/cert.pem;
  ssl_certificate_key /etc/ssl/live/yourls/privkey.pem;

  root /var/www/yourls;

  index index.php;

  access_log /var/log/nginx/yourls/access.log;
  error_log /var/log/nginx/yourls/error.log warn;

  location / {
    try_files $uri $uri/ /yourls-loader.php$is_args$args;

  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    include fastcgi_params;

I hope someone can help.
I want to use it under ISPConfig with nginx but there i get only a 404 back on shorted domain and the following in the Logs:

021/02/14 17:48:54 [error] 14207#14207: *57 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: ***IP ADDRESS***, server: <domain.tld>, request: "GET /mediapack HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/web8.sock:", host: "<domain.tld>"

I’d guess it’s to do with the line index index.php; or try_files $uri =404;. Does removing either of those help?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.