Skip to content

[Ubuntu] Setup https on localhost

  1. install required library

    apt install libnss3-tools -y

  2. download, give permission & copy/move to bin folder:

    chmod +x mkcert-v1.1.2-linux-amd64
    cp mkcert-v1.1.2-linux-amd64 /usr/local/bin/mkcert

  3. Generate local CA

    sudo mkcert -install
    sudo mkcert -CAROOT

  4. Generate Local SSL Certificates, for example my local domain is “”

    sudo mkcert

  5. Then it will generate, like this

    The certificate is at “./” and the key at “./”

  6. install on your web server,

    NGINX, on .conf file :

    listen 80;
    listen 443 ssl;
    ssl on;
    ssl_certificate /path/to/;
    ssl_certificate_key /path/to/;

    APACHE, on .conf file:

    SSLCertificateFile /path/to/
    SSLCertificateKeyFile /path/to/


  7. restart your apache/nginx service


Comments are closed.