docker构建openresty,


1,安装docker

2,配置

编写openresty的配置放入制定目录

本示例地址 :/Users/king/Documents/docker/openresty/nginx

nginx配置:


lua配置:


参数说明:

请求8080地址 跳转到lua文件内lua根据url后面的serverId参数转发到210001或210002对应的服务器

3,启动openresty镜像

docker run --restart=always --name testopenresty -v /Users/king/Documents/docker/openresty/nginx:/usr/local/openresty/nginx/:rw -p 8080:8080 -d openresty/openresty:centos

参数详解

--restart=always 开机启动

-v /Users/king/Documents/docker/openresty/nginx:/usr/local/openresty/nginx/:rw  挂载本地目录到镜像内目录

-p 8080:8080 映射 8080端口



相关内容

    暂无相关文章