To install an SSL certificate on your Amazon AMI Linux instance, follow these organized steps:
- Create a configuration file (
example.com.cnf) with your domain details. - Generate the CSR and private key:
- Submit CSR to Certificate Authority (CA):
- Upload
csr.pemto your CA provider (e.g., Esadax) to obtain certificate files. - Create a temporary key for installation:
- Ensure the temp key is securely managed and removed after use.
- Upload
- Restart Relevant Services:
- For Nginx:
sudo nginx -s reload - For Apache:
sudo systemctl reload apache2
- For Nginx:
- Verify SSL Installation:
- Use
openssl s_clientto check the certificate and ensure it's trusted.
- Use
Set Permissions:
chmod 600 privateKey.pem
chmod 600 temp.pem
Install SSL Certificate on Linux Instance:
sudo openssl x509 -req -in server.crt -key -out temp.pem -days 365 -nodes
Combine Certificate and Private Key:
cat privateKey.pem certificate.pem > server.crt
Generate CSR and Private Key:
echo '[NewRequest]' > example.com.cnf
echo 'Subject = "/C=US/ST=CA/L=Mountain View/O=My Company/OU=IT/CN=myserver"' >> example.com.cnf
echo 'Exportable = TRUE' >> example.com.cnf
echo 'KeyLength = 2048' >> example.com.cnf
echo 'KeySpec = 1' >> example.com.cnf
echo 'KeyUsage = 0xf0' >> example.com.cnf
echo 'MachineKeySet = TRUE' >> example.com.cnf
openssl req -key privateKey.pem -out csr.pem -reqext -config example.com.cnf
