It’s common for many webmasters to want to ensure that only one version of their pages are accessible by search engines and users. Here is a guide on how to remove or force trailing slashes using Nginx.
How to Remove Trailing Slashes in Nginx
rewrite ^/(.*)/$ /$1 permanent;
How to Force Trailing Slashes in Nginx
rewrite ^(.*[^/])$ $1/ permanent;