User Tools

Site Tools


Sidebar


guides:install:self-signed_ssl_certificates_for_ubuntu_apache

How To: Create self-signed SSL Certificates for Ubuntu Apache

Install apache2

sudo apt-get update
sudo apt-get install apache2

Activate SSL Module

sudo a2enmod ssl
sudo service apache2 restart

Create a Self-Signed SSL Certificate

sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Configure Apache to use SSL

sudo vi /etc/apache2/sites-available/default-ssl.conf

Add the following to the default-ssl.conf

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin admin@example.com
        ServerName your_domain.com
        ServerAlias www.your_domain.com
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                        SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                        SSLOptions +StdEnvVars
        </Directory>
        BrowserMatch "MSIE [2-6]" \
                        nokeepalive ssl-unclean-shutdown \
                        downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    </VirtualHost>
</IfModule>

Activate apache ssl virtual host

sudo a2ensite default-ssl.conf
sudo service apache2 restart
guides/install/self-signed_ssl_certificates_for_ubuntu_apache.txt · Last modified: 2016/04/16 18:12 by michaelc