nginx configuration no trailing slash / and redirect to trailing slash /

Solution 1:

If I understand you correctly, you just want to use PHPMyAdmin under /phpmyadmin/. Why don't you just deliver (instead of delivering content under /phpmyadmin) a redirect from /phpmyadmin to /phpmyadmin/ and be done with it?

location /phpmyadmin
{
    return 303 https://example.com/phpmyadmin/;
}

Untested.