This is well-tested and should work fine. The basic idea is to let nginx sort requests between Discourse and your other services. You can find more details here:
The SMTP server is separate and should work, but please note that sending mails yourself is terribly painful. I’d highly recommend using a commercial mailing service for this, e.g. SendGrid.