Installing an older version needs its exact version string, and that string is hard to guess.
apt-cache madison nginx
sudo apt install nginx=VERSION
madison prints one line per available version and source, with the suite it comes from, for example a security pocket and the main release. Copy the version from the second column and use package=version with apt install. If a newer version of a dependency is needed, apt tells you and refuses. It lists only what the package lists from your enabled repositories offer, and only for your architecture.
Further reading: apt-cache manual page