How to setup certificates in Apache
Brief notes on setting up certificates in Apache. More a personal note than a blog post :)
sudo mkdir /etc/apache2/ssl
sudo mkdir /etc/apache2/ssl/private
sudo chmod 755 /etc/apache2/ssl
sudo chmod 710 /etc/apache2/ssl/private
sudo chown -R root:root /etc/apache2/ssl/
sudo chown -R root:ssl-cert /etc/apache2/ssl/private/
Copy cert to /etc/apache2/ssl
Copy key to /etc/apache2/ssl/private
sudo chmod 644 /etc/apache2/ssl/*.crt
sudo -s
sudo chmod 640 /etc/apache2/ssl/private/*.key
exit
sudo a2enmod ssl
Edit config files
sudo nano /etc/apache/sites-available/000-default.conf
DocumentRoot /var/www/html2
ServerName www.yourdomain.com
SSLEngine on
SSLCertificateFile /path/to/your_domain_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
sudo a2ensite 000-default apachectl configtest
sudo systemctl restart apache2.service
sudo mkdir /etc/apache2/ssl
sudo mkdir /etc/apache2/ssl/private
sudo chmod 755 /etc/apache2/ssl
sudo chmod 710 /etc/apache2/ssl/private
sudo chown -R root:root /etc/apache2/ssl/
sudo chown -R root:ssl-cert /etc/apache2/ssl/private/
Copy cert to /etc/apache2/ssl
Copy key to /etc/apache2/ssl/private
sudo chmod 644 /etc/apache2/ssl/*.crt
sudo -s
sudo chmod 640 /etc/apache2/ssl/private/*.key
exit
sudo a2enmod ssl
Edit config files
sudo nano /etc/apache/sites-available/000-default.conf
sudo a2ensite 000-default apachectl configtest
sudo systemctl restart apache2.service
Comments
Post a Comment