brew install mkcert
mkcert -install
mkcert local.place-your-domain-here.com localhost 127.0.0.1 ::1
Two .pem
files will be generated. rename them as domain.pem
and domain-key.pem
add 127.0.0.1 local.place-your-domain-here.com
to your /private/etc/hosts
file
touch nginx.conf
events {
}
http {
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate ~/domain.pem;
ssl_certificate_key ~/domain-key.pem;
server_name local.place-your-domain-here.com;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
nginx -c nginx.conf -p .
now you can open https://local.place-your-domain-here.com
This is okay. You can add certificate to your browser or just ignore this warning. You are the one who generate this certificate and you have nothing to worry about ;) Also, make sure you use mkcert for testing and developing purposes, this is not suitable for production, and never share your rootCA-key.pem with anyone