'How can I use an SSL certificate with my Next JS deployment?

I have a Next.js deployment on an EC2 instance. I want to install an SSL certificate. The only way I can think of is to use a custom server config, but this seems to remove certain optimizations that I'd rather keep. Keep in mind I am starting the server using 'next start'.

The solutions I found online only apply to local deployments and they also involve using a custom server config.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source