Closed benhartwich closed 4 years ago
Looks like shlink is not able to open/read this directory /var/www/shortener/htdocs/shlink.orig/module/Core/templates
.
I think it could be some kind of permissions issue. Can you first verify if that directory actually exists for you?
Ah I changed the directory to shlink. Is the directory structure saved to the database?
No, but it is defined in a configuration which is merged and cached.
You will have to delete the data/cache/app_config.php
file and it will start working.
However, that file should be deleted when running the update script. Did you change the folder before or after running the update script?
After the update. But I got an error that the cache couldn´t be deleted:
OUT OUT // Clearing all Metadata cache entries OUT OUT [ERROR] No cache entries were deleted. OUT OUT RES 1 Command did not run successfully
The update was run by root - so there was no permission problem.
I´ve deleted this file, but the 500 error persists. The log says:
error] 6415#6415: *136986 open() "/var/www/shortener/htdocs/shlink-web/server/2c11406a-8f6f-4fb3-a7f2-b1fb3dad9c43/short-code/6VjV/visits" failed (2: No such file or directory)
After the update
Ok, then it's ok. I was thinking of there could be a bug there.
I will better document this, as it's not very intuitive that renaming the folder breaks shlink, haha.
But I got an error that the cache couldn´t be deleted:
OUT OUT // Clearing all Metadata cache entries OUT OUT [ERROR] No cache entries were deleted. OUT OUT RES 1 Command did not run successfully The update was run by root - so there was no permission problem.
Yeah, don't worry about that. It fails when using APCu, but it does not affect Shlink's installation as everything else worked.
I have already fixed it to fail silently, as it is not a real error.
The fix will be included in next release.
I´ve deleted this file, but the 500 error persists. The log says: error] 6415#6415: *136986 open() "/var/www/shortener/htdocs/shlink-web/server/2c11406a-8f6f-4fb3-a7f2-b1fb3dad9c43/short-code/6VjV/visits" failed (2: No such file or directory)
This is a different error now, and it's not shlink, but the web client.
The thing here is that shlink-web-client has a client-side routing system which generates some dynamic routes which do not work when sent to the server.
You have to configure your web server to fallback any non-existing file to the index.html
You can find more info here https://shlink.io/documentation/shlink-web-client/installation/#self-hosted
See the "considerations" section.
I tried these nginx rules, but this doesn´t work at all - I can´t event access my server anymore. Fallback needs to be index.php instead index.html
Shlink-web-client does not have a index.php file at all. It is purely static :thinking:
Are you maybe editing Shlink's config by mistake?
Or maybe you are serving both shlink and shlink-web-client under the same domain?
If that's the case, you should at least serve the web client under a different subpath at least, but I would recommend a subdomain instead, to avoid this kind of conflicts.
Or even better, use https://app.shlink.io and then you can forget about shlink-web-client completely :slightly_smiling_face:
Ah, I edited the wrong host. I´m hosting the web client with a subdomain like you do. The log error is gone, but I´m still getting the same error (invalid response). Have I to delete any cache?
If you are still getting an error but nothing gets logged on shlink, then the issue has to be on nginx config.
Can you check nginx logs? You will probably have something there.
I don´t know why, but it works now. Cache related or the cronjob for generating the stats solved it anyhow.
How Shlink is set-up
Summary
Current behavior
I cannot access any stats of a shared link. Causes a 500 error:
2020/05/05 08:45:03 [error] 30002#30002: *132723 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught LogicException: The specified directory path "/var/www/shortener/htdocs/shlink.orig/module/Core/config/../templates" does not exist. in /var/www/shortener/htdocs/shlink/vendor/league/plates/src/Template/Folder.php:72 Stack trace: #0 /var/www/shortener/htdocs/shlink/vendor/league/plates/src/Template/Folder.php(39): League\Plates\Template\Folder->setPath() #1 /var/www/shortener/htdocs/shlink/vendor/league/plates/src/Template/Folders.php(31): League\Plates\Template\Folder->__construct() #2 /var/www/shortener/htdocs/shlink/vendor/league/plates/src/Engine.php(115): League\Plates\Template\Folders->add() #3 /var/www/shortener/htdocs/shlink/vendor/mezzio/mezzio-platesrenderer/src/PlatesRenderer.php(78): League\Plates\Engine->addFolder() #4 /var/www/shortener/htdocs/shlink/vendor/mezzio/mezzio-platesrenderer/src/PlatesRendererFactory.php(64): Mezzio\Plates\PlatesRenderer->addPath() #5 /var/www/shortener/htdocs/shlink/vendor/laminas/laminas-servicemanager/src/ServiceM" while reading response header from upstream