Nginx-1.10.3 with luaJIT nginx_upstream_check_module nginx_cache_purge_module..
804
Dockerfile linksNginx-1.10.3 镜像集成模块列表:
Dockerfile文件的ARG参数可控制开启/关闭相应功能
ARG WITH_DEBUG=false
ARG WITH_NDK=true
ARG WITH_LUA=true
ARG WITH_PURGE=true
ARG WITH_UPSTREAM_CHECK=true
自动化构建镜像的可用Dockerhub和推荐的安装方法
docker pull johnwu/nginx:1.10.3
或者你可以自己构建镜像
docker build -t johnwu/nginx github.com/vla/docker-nginx
运行nginx:
docker run --name nginx -d \
-p 80:80 --restart=always \
johnwu/nginx
或者您可以使用示例docker-compose.yml文件启动容器
自定义您的配置文件覆盖容器默认的/etc/nginx/nginx.conf配置
docker run --name nginx -d \
-v /some/nginx.conf:/etc/nginx/nginx.conf:ro \
johnwu/nginx
挂载您自己的sites-enabled目录到/etx/nginx/sites-enabled
docker run --name nginx -d \
-v /some/nginx.conf:/etc/nginx/nginx.conf:ro \
-v /srv/docker/nginx/sites-enabled:/etc/nginx/sites-enabled \
johnwu/nginx
重新加载的NGINX配置使用kill -s HUP发送到容器上
docker kill -s HUP nginx
访问Nginx日志位于/var/log/nginx
docker exec -it nginx tail -f /var/log/nginx/access.log
docker run -p 80:80 --name nginx -d \
johnwu/nginx nginx -c /etc/nginx/test.conf
先访问http://localhost/index.html ,然后再次访问http://localhost/purge/index.html会看到效果
其实访问http://localhost/index.html地址已经使用反向代理到http://localhost:8045/index.html页面上
访问http://localhost/lua页面将会显示hello lua.
访问http://localhost/status1页面将会显示stub状态
访问http://localhost/status2页面将会显示upstream状态
Content type
Image
Digest
Size
17.5 MB
Last updated
over 9 years ago
docker pull johnwu/nginx