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
It works! But I get an "not safe" error from the browser