Skip to content

Nginx-1.10.3,集成 luaJIT nginx_upstream_check_module nginx_cache_purge_module ...

License

Notifications You must be signed in to change notification settings

choi2k/docker-nginx

 
 

Repository files navigation

Build Status

Supported tags and respective Dockerfile links

Introduction

Nginx-1.10.3 镜像集成模块列表:

  • pagespeed
  • luaJIT
  • lua-nginx-module
  • nginx_upstream_check_module
  • nginx_cache_purge_module
  • nginx_devel_kit

Dockerfile文件的ARG参数可控制开启/关闭相应功能

ARG WITH_DEBUG=false
ARG WITH_NDK=true
ARG WITH_LUA=true
ARG WITH_PURGE=true
ARG WITH_UPSTREAM_CHECK=true

Installation

自动化构建镜像的可用Dockerhub和推荐的安装方法

docker pull eswork/nginx:1.10.3

或者你可以自己构建镜像

docker build -t eswork/nginx github.com/eswork/docker-nginx

Quickstart

运行nginx:

docker run --name nginx -d \
  -p 80:80 --restart=always \
  eswork/nginx 

或者您可以使用示例docker-compose.yml文件启动容器

Configuration

自定义您的配置文件覆盖容器默认的/etc/nginx/nginx.conf配置

docker run --name nginx -d \
-v /some/nginx.conf:/etc/nginx/nginx.conf:ro \
eswork/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 \
eswork/nginx

重新加载的NGINX配置使用kill -s HUP发送到容器上

docker kill -s HUP nginx

Logs

访问Nginx日志位于/var/log/nginx

docker exec -it nginx tail -f /var/log/nginx/access.log

Test

执行以下命令启动容器

docker run -p 80:80 --name nginx -d \
eswork/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状态

About

Nginx-1.10.3,集成 luaJIT nginx_upstream_check_module nginx_cache_purge_module ...

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 82.5%
  • Nginx 15.9%
  • Makefile 1.6%