Without further ado, let’s get started:
Local SSL
mkdir -p ~/.localhost-ssl
sudo openssl genrsa -out ~/.localhost-ssl/localhost.key 2048
sudo openssl req -new -x509 -key ~/.localhost-ssl/localhost.key -out ~/.localhost-ssl/localhost.crt -days 3650 -subj /CN=localhost
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/.localhost-ssl/localhost.crt
Add the key and certificate to nginx.conf
vim /usr/local/etc/nginx/nginx.conf
server {
listen 3000 ssl;
ssl on;
ssl_certificate /Users/username/.localhost-ssl/localhost.crt;
ssl_certificate_key /Users/username/.localhost-ssl/localhost.key;
ssl_ciphers HIGH:!aNULL:!MD5;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}