This is a simple Apache image, including SSL support. In order to use this image effectively, you'll need to mount:
- /var/www/html for your site content (e.g. using "-v /home/jdoe/mysite/:/var/www/html/")
- /var/log/apache2, optionally, if you want to store logfiles visibly outside the container
- /etc/ssl, optionally, if you wish to use SSL with real keys
A note on SSL
As per the defaults, Apache will use the bundled "snakeoil" key when serving SSL. Obviously this isn't sufficient or advisable for production, so you'll want to mount your real keys onto /etc/ssl/. If you name them "certs/ssl-cert-snakeoil.pem" and "private/ssl-cert-snakeoil.key", you'll be able to get by with the default config. Otherwise, you'll want to include a revised site definition. If you don't want to use SSL, you can avoid forwarding port 443 when launching the container (see below).
Assuming you have your content at /home/jdoe/mysite/, the below will be sufficient to serve it. Note that many Docker users encourage mounting data from a storage container, rather than directly from the filesyetem.
- "It works!":
docker run -p 80:80 -p 443:443 -d eboraas/apacheand browse to the host's IP address using http or https
- Serving actual content with SSL support:
docker run -p 80:80 -p 443:443 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
- ... without SSL support:
docker run -p 80:80 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
- ... using non-standard ports:
docker run -p 8080:80 -p 8443:443 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
Any tips to use virtual hosts?
@docstreamadmin Apache is kept up to date against the current stable version of Debian. At this time, that means 2.4.10-10+deb8u4 (which is 2.4.10 with active security maintenance). It's updated daily to stay current with the latest fixes.
Version is 2.4.10!
My apologies for the inexcusable delays in updating this image. All of the reported errors should now be fixed. Going forward, I am committing to keeping this image up-to-date and in good working order.
For those who are interested, while a number of the proposed solutions to the SHMCB issue would work, it seems that the best solution is actually the most obvious: I've updated the base image to use a2enmod instead of hand-creating the symlinks; this actually ensures that the SHMCB dependency is resolved automatically, enabling the module without any further steps. This is, in my mind, the simplest and most future-proof approach.
Thanks for all your feedback!
Add this line to the docker file to fix the issue with the SSLSessionCache
RUN /bin/ln -sf ../mods-available/socache_shmcb.load /etc/apache2/mods-enabled/
Does it work for others?
I get errors.
anovil@anovil-Latitude-E6440:~/tmp/serverfault/docker/haproxy$ docker run -it eboraas/apache /bin/bash
root@ff105ba15d95:/# /usr/sbin/apache2ctl -D FOREGROUND
AH00526: Syntax error on line 43 of /etc/apache2/mods-enabled/ssl.conf:
SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).
Action '-D FOREGROUND' failed.
The Apache error log may have more information.
maybe you could try
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* for making the image a bit smaller
The bad thing is that their is an error that everybody is encountering yet the owner of this image doesn't update it.
cp /etc/apache2/mods-available/socache_shmcb.load /etc/apache2/mods-enabled/
but no positive results.
For anyone with sps4's question: the Dockerfile at the project page shows the following ENV variables setting the Apache USER and RUNGROUP to
ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data
The 'latest' image have some problem, it looks like mod_socache_shmcb.so is not loaded correctly:
Status: Downloaded newer image for eboraas/apache:latest AH00526: Syntax error on line 43 of /etc/apache2/mods-enabled/ssl.conf: SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?). Action '-D FOREGROUND' failed. The Apache error log may have more information.