an alpine nginx unit for serving static files purpose
332
an alpine nginx unit for serving static files purpose
docker build --tag nginx-unit-alpine .
www-data user is created and added to the group with the same name for you.
.unit.config.json.unit.config.json to /docker-entrypoint.d/ directoryExample:
FROM javadmnjd/nginx-unit-alpine
COPY . /var/www/
RUN chown -R www-data:www-data /var/www \
&& mv /var/www/unit.config.json /docker-entrypoint.d/
WORKDIR /var/www/
CMD ["/usr/sbin/unitd", "--no-daemon", "--control","unix:/var/run/control.unit.sock"]
EXPOSE 80
Example .unit.config.json for the above Dockerfile:
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": [
"*.manifest",
"*.appcache",
"*.html",
"*.json",
"*.rss",
"*.atom",
"*.jpg",
"*.jpeg",
"*.gif",
"*.png",
"*.ico",
"*.cur",
"*.gz",
"*.svg",
"*.svgz",
"*.mp4",
"*.ogg",
"*.ogv",
"*.webm",
"*.htc",
"*.css",
"*.js",
"*.ttf",
"*.ttc",
"*.otf",
"*.eot",
"*.woff",
"*.woff2",
"*.txt"
]
},
"action": {
"share": "/var/www/$uri",
"index": "index.html",
"chroot": "/var/www/",
"follow_symlinks": false,
"traverse_mounts": false
}
}
],
"access_log": "/dev/stdout"
}
Content type
Image
Digest
sha256:bd75f43b8…
Size
5.9 MB
Last updated
almost 4 years ago
docker pull javadmnjd/nginx-unit-alpine