Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ ADD root/usr /usr
ADD root/etc /etc
ADD root/system-docker-entrypoint.d/wwwroot.sh /system-docker-entrypoint.d/10-wwwroot.sh

# Add configuration for SSL.
ADD root/system-docker-entrypoint.d/ssl.sh /system-docker-entrypoint.d/20-ssl.sh
ADD root/etc/apache2/conf-enabled/certificate.conf /etc/apache2/conf-enabled/certificate.conf
EXPOSE 443

# Fix the original permissions of /tmp, the PHP default upload tmp dir.
RUN chmod 777 /tmp && chmod +t /tmp

Expand Down
5 changes: 5 additions & 0 deletions root/etc/apache2/conf-enabled/certificate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Alias "/certificates" "/var/www/certificates"
<Directory "/var/www/certificates">
Require all granted
</Directory>

17 changes: 17 additions & 0 deletions root/system-docker-entrypoint.d/ssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
echo
echo "#######################################"
echo "# moodle-php-apache ssl setup"
echo "#######################################"
echo "#"
echo "# Setting up Apache DocumentRoot"
openssl req -x509 -nodes -days 365 \
-newkey rsa:2048 \
-keyout /etc/ssl/private/ssl-cert-snakeoil.key \
-out /etc/ssl/certs/ssl-cert-snakeoil.pem \
-subj "/C=AU/ST=WA/L=Perth/O=Security/OU=Development/CN=example.com"

a2ensite default-ssl
a2enmod ssl

mkdir /var/www/certificates
cp /etc/ssl/certs/ssl-cert-snakeoil.pem /var/www/certificates/certificate.pem
Loading