Skip to content

Generate a self-signed Certificate for a Domain

We can use openssl to generate a self-signed certificate for a domain for testing puspose, and use it for Nginx or any other tools.

The following command are used to generate.

Bash
sudo mkdir /etc/ssl/domain

sudo openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /etc/ssl/domain/private.pem -out /etc/ssl/domain/public.pem
It will ask several questions, you should be carefull with the common name, usually, input the domain name.