Jul 16, 2024
sudo
for each command.sudo
.Syntax: openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/filename.key -out /etc/ssl/certs/filename.crt
Parameters:
-x509
: Output a self-signed certificate instead of a certificate request.-nodes
: No DES, do not encrypt the private key.-days 365
: Certificate is valid for 365 days.-newkey rsa:4096
: Generate an RSA key with 4096 bits.-keyout
: Specify the file to write the private key to.-out
: Specify the file to write the certificate to.File Locations:
/etc/ssl/private/filename.key
/etc/ssl/certs/filename.crt
/etc/apache2/sites-available/default-ssl.conf
SSLCertificateFile
directive to point to your certificate file./etc/ssl/certs/filename.crt
).www-data
).
chown www-data:www-data /etc/ssl/certs/filename.crt
chown www-data:www-data /etc/ssl/private/filename.key
a2enmod ssl
: Enable SSL module.a2enmod headers
: Enable Headers module.a2ensite default-ssl
: Enable the default SSL site.systemctl restart apache2