Redirect old forum URLs to new Discourse URLs using permalinks

Have a look at Set up Let’s Encrypt with multiple domains / redirects and use the same kind of thing as in that example that adds to the nginx config.

You can put it in the after_ssl hook (that you would add) as in that one.