Simple Local HTTPS Setup for Next.js Using mkcert

This guide shows how to run a Next.js project locally with HTTPS using a fake local domain like:

https://myshop.localdev:3443

Step 1 — Add Local Domain to macOS Hosts File

Open Terminal:

sudo nano /etc/hosts

Add:

127.0.0.1 myshop.localdev

Save the file and flush DNS: