Apache

From wiki.kungfootek.net
Jump to: navigation, search

Self Signed Certificates

Make sure you have mod_ssl installed first.

yum install mod_ssl


Execute this one liner to create all the certs you need. No need for an intermediate, or bundled cert here.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout domain_year_tld.KEY -out domain_year_tld.CRT


In your config file:

NameVirtualHost *:443
<VirtualHost *:443>
    ServerAdmin email@domain.tld
    DocumentRoot /path/to/files
    ServerName hostname.of.server
        ServerAlias domain.tld *.tld

    ErrorLog logs/ssl-domain_tld-error_log
    CustomLog logs/ssl-domain_tld-access_log common
        <Directory "/path/to/files">
             AllowOverride All ## Don't like this, but here for .htaccess settings which SHOULD live in this file, or be included by this file.
        </Directory>

    SSLEngine on
    SSLCertificateFile /etc/httpd/certs/domain_year_tld.CRT
    SSLCertificateKeyFile /etc/httpd/certs/domain_year_tld.KEY

</VirtualHost>