docker-nginx-alpine
docker-nginx-alpine copied to clipboard
Nginx Alpine image, support Lua 、nginx-echo 、nginx-brotli 、nginx-http-concat 、WebP 、TLSv1.3
docker-nginx-alpine
Nginx v1.14.2 Alpine 镜像,支持 以下模块:
- lua-nginx-module
- nginx-echo
- nginx-brotli
- nginx-http-concat
- ngx_headers_more
- openresty/lua-resty-core
- openresty/lua-resty-lrucache
- LuaRocks 3.8.0
- WebP 转换
- TLSv1.3
使用
直接覆盖默认配置文件
# ./nginx.conf
server {
...
}
docker run \
--name nginx \
-v "$(pwd)/nginx.conf":/etc/nginx/conf.d/default.conf \
-p 80:80 \
-p 443:443 \
ghcr.io/shangxianapp/nginx:latest-alpine
自定义 Nginx 入口配置
docker run \
--name nginx \
-v "$(pwd)/nginx.conf":/etc/nginx/nginx.conf \
-v "$(pwd)/vhost":/etc/nginx/vhost \
-p 80:80 \
-p 443:443 \
ghcr.io/shangxianapp/nginx:latest-alpine
功能
二次 LuaRocks 安装:
FROM ghcr.io/shangxianapp/nginx:latest-alpine
WORKDIR /etc/nginx
RUN luarocks install lua-cjson
RUN luarocks install luasocket
COPY . .
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]%
注意
为了让 Lua 有写入文件权限,在创建 nginx 用户时使用了 -u 1000 以提高用户权限。
开发
构建镜像
make build
测试
为了测试 HTTPS 支持,请添加 Hosts 127.0.0.1 www.fe.com ,并运行:
make test
License
MIT