Holding a package stops it once. A pin file says which version or release apt should prefer for good.
# /etc/apt/preferences.d/nginx
Package: nginx*
Pin: version 1.24.*
Pin-Priority: 1001
A priority above 1000 makes apt install that version even if it means a downgrade, and it stops upgrades to anything that does not match the pattern. Check the result with apt policy nginx, which shows the priority next to every candidate. The file name must only use letters, digits, underscores, hyphens and periods, and files with other extensions are ignored. Remove the file to go back to normal behaviour.
Further reading: apt_preferences manual page