Solved Apache24 Self Signed TLS Cert on localhost

Is there is simple way to have a self signed tls cert on localhost with apache24?

I only need it for testing. This machine is not open for any external connections.
 

TL;DR

openssl req -x509 -newkey rsa:4096 -keyout /usr/local/etc/apache24/server.key -out /usr/local/etc/apache24/server.crt -sha256 -days 3650 -nodes -subj "/C=US/ST=OK/L=Oklahoma city/O=LibreQuest/OU=IT/CN=FreeBSD-Hostname"
sed -i '' -e '/httpd-ssl/s/^#//g' -e '/shmcb/s/^#//g' -e '/LoadModule ssl_module/s/^#//g' /usr/local/etc/apache24/httpd.conf
service apache24 enable
service apache24 start
 
Thank you so much. This works perfectly. Just had to add lines to /usr/local/etc/apache24/httpd.conf

Bash:
LoadModule ssl_module /usr/local/libexec/apache24/mod_ssl.so


Listen 443

<VirtualHost *:443>

    ServerName LibreQuest

    SSLEngine on

    SSLCertificateFile "/usr/local/etc/apache24/server.crt"

    SSLCertificateKeyFile "/usr/local/etc/apache24/server.key"

</VirtualHost>
 
Back
Top