How to fix the double slash bug via Nginx?

Magento does not eliminate a double slash after the domain name.
You can see the bug on any Magento website, e.g.:
https://marketplace.magento.com/tnw-quickbooks-full.html
https://marketplace.magento.com//tnw-quickbooks-full.html

The solution for Nginx:

server {
    <…>
	merge_slashes off;
	rewrite (.*)//+(.*) $1/$2 permanent;
    <…>
}

superuser.com/a/565423