Well, I got to a point where I think that it's not worth it.
I have no f* clue why I get 502 bad request error. I checked file & folder permissions, I configured PHP, PHP-FPM and Nginx correctly, error logs are empty, access logs do not help much, I followed all your suggestions, double - triple - quadro checked my settings, all seems that it should've worked just fine.
It works with Apache, but I want to run it with Nginx; moreover, it works with docker on Linux and not with docker on Mac, just wtf...
The line that causes the 502 bad request is $router = $di->getRouter();
inside config/router.php
for reasons unknown to me.