SSl on local domian

Hey there! I'm currently working as an Associate DevOps Engineer, and I'm diving into popular DevOps tools like Azure Devops,Linux, Docker, Kubernetes,Terraform and Ansible. I'm also on the learning track with AWS certifications to amp up my cloud game. If you're into tech collaborations and exploring new horizons, let's connect!
To generate a new SSL certificate with the correct details, follow these steps:
Make sure you have OpenSSL installed on your Ubuntu server. If not, you can install it with the following command:
sudo apt-get install opensslGenerate a private key: Run the following command to generate a private key file:
sudo openssl genpkey -algorithm RSA -out /etc/ssl/private/website1.local.key -pkeyopt rsa_keygen_bits:2048Generate a certificate signing request (CSR): Use the private key to generate a CSR by running the following command:
sudo openssl req -new -key /etc/ssl/private/website1.local.key -out /etc/ssl/certs/website1.local.csrDuring the CSR generation process, you will be prompted to provide information such as your organization details and the Common Name (CN). Make sure to enter the following information:
Common Name (CN): website1.local
Organization (O): Your organization name (optional)
Organizational Unit (OU): Your organizational unit (optional)
Generate a self-signed SSL certificate: Run the following command to generate a self-signed SSL certificate using the CSR:
sudo openssl x509 -req -days 365 -in /etc/ssl/certs/website1.local.csr -signkey /etc/ssl/private/website1.local.key -out /etc/ssl/certs/website1.local.crtVerify the generated certificate: You can verify the details of the newly generated certificate by running the following command:
sudo openssl x509 -in /etc/ssl/certs/website1.local.crt -noout -textCheck that the Common Name (CN) is set to "website1.local" and that the other details are correct.
Once you have generated the new SSL certificate, you can proceed with configuring your web server (such as Nginx) to use the new certificate. Remember to restart the web server for the changes to take effect.
Note: When accessing the website, make sure the domain name "website1.local" resolves to the correct IP address in your local DNS or hosts file.




