Apache2 SSL Configuration Steps

Server Side
root@28cf3aec9d2e:~# openssl req -x509 -nodes -days 1095 /
-newkey rsa:2048 -out /etc/apache2/ssl/example.crt /
-keyout /etc/apache2/ssl/example.key
root@28cf3aec9d2e:/# a2dissite example.conf
Site example disabled.
To activate the new configuration, you need to run:
service apache2 reload
root@28cf3aec9d2e:/# apachectl restart
root@28cf3aec9d2e:~# nano /etc/apache2/sites-available/example.conf
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/example
ErrorLog /var/log/apache2/exampleError.log
CustomLog /var/log/apache2/example.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example.crt
SSLCertificateKeyFile /etc/apache2/ssl/example.key
</VirtualHost>
root@28cf3aec9d2e:/# a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled
root@28cf3aec9d2e:/# a2ensite example.conf
Enabling site example.
To activate the new configuration, you need to run:
service apache2 reload
root@28cf3aec9d2e:/# apachectl restart
Workstation Side
webdev@localhost:~# firefox https://example.com



Comments

Popular Posts