Skip to content

Commit

Permalink
Feat: generate ssl-cert
Browse files Browse the repository at this point in the history
  • Loading branch information
Marika Bertelli authored and Marika Bertelli committed Jan 30, 2025
1 parent f875748 commit b2bab20
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions images/wordpress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,26 @@ COPY wordpress.conf /etc/apache2/sites-enabled/
COPY mu-plugins /usr/src/mu-plugins/
COPY wp-config.php /var/www/html/wp-config.php

RUN openssl req -x509 \
-out /etc/ssl/certs/apache-localhost.crt \
-keyout /etc/ssl/private/apache-localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' \
-extensions EXT \
-config /dev/stdin <<EOF
[dn]
CN=localhost
[req]
distinguished_name = dn
[EXT]
subjectAltName=DNS:localhost
keyUsage=digitalSignature
extendedKeyUsage=serverAuth
EOF
COPY apache-https.conf /etc/apache2/sites-available/
RUN a2enmod ssl
RUN apache2ctl configtest
RUN a2ensite apache-https

ENTRYPOINT ["wp-start"]
CMD ["apache2-foreground"]
8 changes: 8 additions & 0 deletions images/wordpress/apache-https.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<VirtualHost *:443>
DocumentRoot "/var/www/html"
ServerName localhost

SSLEngine on
SSLCertificateFile "/etc/ssl/certs/apache-localhost.crt"
SSLCertificateKeyFile "/etc/ssl/private/apache-localhost.key"
</VirtualHost>

0 comments on commit b2bab20

Please sign in to comment.