DEV Community

Yegor Shytikov
Yegor Shytikov

Posted on

Trusted HTTPS/SSL for localhost/127.0.0.1

mkcert(https://github.com/FiloSottile/mkcert) is a simple tool for making locally-trusted development certificates for localhost or 127.0.0.1. It requires no configuration.

Installation

yum instal go
git clone https://github.com/FiloSottile/mkcert && cd mkcert
go build -ldflags "-X main.Version=$(git describe --tags)"
Enter fullscreen mode Exit fullscreen mode

Generate

./mkcert -install 

./mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1

ls
Enter fullscreen mode Exit fullscreen mode

You should see certificates in current folder

Nginx configuration

server {
    listen 80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
}

server {
  #listen 80;
  listen 443 ssl;
  server_name 127.0.0.1;

  ssl_certificate /root/mkcert/127.0.0.1.pem;
  ssl_certificate_key /root/mkcert/127.0.0.1-key.pem;

 ## replace  /root/mkcert/ to your path 

  ##ADDITIONAL_CONFIG

}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)