From Discourse’s perspective, 404 is correct since it doesn’t exist and never did.
If you have a list of old pages, probably the easiest thing to do is create a custom outlet file for nginx that tells it to return with 410
when those pages are hit.