Hello,
Is this procedure still valid?
Because I have not been able to configure SSL. The deployment is successful but it does not work for https. I even encountered an issue with the set_SSL.sh
script - it targets /etc/templates/apache.conf
, which was absent. I worked around this by creating apache.conf
from apache.conf.tmpl
.
Setup:
Directory Structure:
isudo@f37-srv:~/owncloud$ pwd
/home/isudo/owncloud
isudo@f37-srv:~/owncloud$ ls
docker-compose.yml ownclouddata
isudo@f37-srv:~/owncloud$
isudo@f37-srv:~/owncloud/ownclouddata$ pwd
/home/isudo/owncloud/ownclouddata
isudo@f37-srv:~/owncloud/ownclouddata$ ls
apacheSSL.inc defaultNetworkBackend libpod networks overlay overlay-containers overlay-images overlay-layers secrets set_SSL.sh ssl storage.lock userns.lock volumes
isudo@f37-srv:~/owncloud/ownclouddata$
isudo@f37-srv:~/owncloud/ownclouddata/ssl$ pwd
/home/isudo/owncloud/ownclouddata/ssl
isudo@f37-srv:~/owncloud/ownclouddata/ssl$ ls
ca-cert.pem ca-cert.srl ca-key.pem server_cert.pem server.csr server_key.pem
isudo@f37-srv:~/owncloud/ownclouddata/ssl$
./owncloud/ownclouddata/set_SSL.sh
#!/usr/bin/env bash
# Check if the template file exists
if [ ! -f "/etc/templates/apache.conf.tmpl" ]; then
echo "Template file does not exist."
exit 1
fi
# Copy the template file to create a new apache.conf file
cp /etc/templates/apache.conf.tmpl /etc/templates/apache.conf
# Check if the apache.conf file was created successfully
if [ $? -eq 0 ]; then
echo "apache.conf file created successfully."
else
echo "Failed to create apache.conf file."
exit 1
fi
# Enable the apache2 SSL module
a2enmod ssl
# Delete previous adding
sed -i '/^include \/mnt/d' /etc/templates/apache.conf
# Adding SSL parameters to the apache.conf template file
sed -i '/<Directory/i include /mnt/data/apacheSSL.inc' /etc/templates/apache.conf
docker-compose.yml:
volumes:
- files:/mnt/data
- ./ownclouddata/set_SSL.sh:/etc/entrypoint.d/13-set_ssl.sh
./owncloud/ownclouddata/apacheSSL.inc
SSLEngine on
SSLCertificateFile /mnt/data/ssl/server_cert.pem
SSLCertificateKeyFile /mnt/data/ssl/server_key.pem
SSLCACertificateFile /mnt/data/ssl/ca-cert.pem
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
After deployment:
isudo@f37-srv:~/owncloud$ podman logs owncloud_owncloud_1
apache.conf file created successfully.
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
service apache2 restart
Creating volume folders...
Creating hook folders...
Waiting for MySQL...
services are ready!
Waiting for Redis...
services are ready!
Removing custom folder...
Linking custom folder...
Removing config folder...
Linking config folder...
Writing config file...
Fixing base perms...
Fixing data perms...
Fixing hook perms...
Upgrading server database...
ownCloud is already latest version
ownCloud is already latest version
Writing objectstore config...
Writing php config...
Updating htaccess config...
.htaccess has been updated
Writing apache config...
Enabling cron background...
Set mode for background jobs to 'cron'
Writing crontab file...
Touching cron configs...
Starting cron daemon...
Starting apache daemon...
[Mon Oct 16 19:00:05.488232 2023] [mpm_prefork:notice] [pid 177] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Mon Oct 16 19:00:05.488271 2023] [core:notice] [pid 177] AH00094: Command line: '/usr/sbin/apache2 -f /etc/apache2/apache2.conf -D FOREGROUND'
After executing service apache2 restart
:
isudo@f37-srv:~/owncloud$ podman exec -it owncloud_owncloud_1 service apache2 restart
/etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars
/etc/init.d/apache2: 57: .: Can't open /etc/apache2/envvars
ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
I try putting this command too in the script but same result.
So my question is: Is this procedure still valid?
I would be very grateful if you could shed some light on what is happening.
Thank you!