This directory contains a replica of alpine apache2 image with ssl with the missing dependnency fix and a minor fix to enable cgi-bin as explained below in the Troubleshooting
IMAGE=alpine-apache
docker build -t $IMAGE -f Dockerfile .NAME=basic-apache-alpine
docker container stop $NAME
docker container rm $NAME
docker run -d --name $NAME -p 80:80 -p 443:443 $IMAGEdocker logs $NAMEthis will show:
run: apache2: (pid 38) 5s
run: crond: (pid 39) 5s
run: rsyslogd: (pid 37) 5s
curl -ksI https://$(hostname -i ):443/index.htmlcurl -ksI https://$(docker-machine ip):443/index.htmlHTTP/1.1 200 OK
Date: Sat, 02 Sep 2023 16:11:07 GMT
Server: Apache/2.4.56 (Unix)
Last-Modified: Sat, 02 Sep 2023 00:23:55 GMT
ETag: "51b-604554add1cc0"
Accept-Ranges: bytes
Content-Length: 1307
Content-Type: text/html
curl -ksI https://$(hostname -i ):443/cgi-bin/statuscode.cgi?code=204curl -ksI https://$(docker-machine ip):443/cgi-bin/statuscode.cgi?code=204HTTP/1.1 204 No Content
Date: Sat, 02 Sep 2023 16:11:16 GMT
Server: Apache/2.4.56 (Unix)
On Windows / Docker Toolbox environment, may observe
fail: apache2: unable to change to service directory: not a directory
run: crond: (pid 37) 5s
run: rsyslogd: (pid 36) 5s
this is because on Windows the soft link is not correctly checked out
down: apache2: 1s, normally up, want up
this is because of line ending conversion
docker exec -it $NAME sh- turns out to not be necessary once Apache configuration is fixed
htpasswd -bc /etc/apache2/.htpasswd user passwordcurl -ksI https://192.168.0.64:443/index.htmlHTTP/1.1 403 Forbidden
Date: Fri, 01 Sep 2023 18:18:29 GMT
Server: Apache/2.4.56 (Unix)
Last-Modified: Fri, 01 Sep 2023 18:02:01 GMT
ETag: "56c-6044ff5153840"
Accept-Ranges: bytes
Content-Length: 1388
Content-Type: text/htmlcurl -ksI https://$(docker-machine ip):443/index.html-
Apply the PR 4 and similar changes fixing the
ScriptAlias -
back out apache configurations
docker cp $NAME:/web/config/conf.d/httpd.conf .
docker cp $NAME:/web/config/httpd.conf .curl -ksI https://localhost:443/cgi-bin/statuscode.cgi?code=204- NOTE: on Windows Docker Toolbox use the following:
curl -ksI https://$(docker-machine ip):443/cgi-bin/statuscode.cgi?code=204HTTP/1.1 204 No Content
Date: Fri, 01 Sep 2023 20:54:08 GMT
Server: Apache/2.4.56 (Unix)
curl -ksI https://localhost:443/cgi-bin/statuscode.cgi?code=999HTTP/1.1 406 Not Acceptable
Date: Fri, 01 Sep 2023 20:56:16 GMT
Server: Apache/2.4.56 (Unix)
docker stop $NAME
docker container rm $NAME
docker image rm $IMAGE
docker volume prune -f