Do I need to install NGINX and PHP to optimize my Discourse forum?

No, there isn’t. It would actually make things a lot more complicated for you.