欢迎光临
我们一直在努力

docker-compose 创建nginx

本站教程收集整理的这篇文章主要介绍了docker-compose 创建nginx,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_419_0@docker-compose 创建Nginx

#######docker-compose 创建Nginx@H_893_2@mkdir -p composetest/Nginx
cd composetest

cat 便宜香港vps >Nginx/Dockerfile <<EOF
FROM centos:6.8
workdir /usr/src
RUN yum install -y zlib-devel gd-devel pcre-devel pcre openssl-devel lua lua-devel gcc gcc-c++ wget
RUN wget -q https://files.cnblogs.com/files/blog-lhong/Nginx-1.0.8.tar.gz
RUN wget -q https://files.cnblogs.com/files/blog-lhong/ngx_open.tar.gz
RUN tar zxf ngx_open.tar.gz -C /usr/src/
RUN tar zxf Nginx-1.0.8.tar.gz -C /usr/src/

workdir /usr/src/Nginx-1.0.8
RUN useradd -M -s /sbin/nologin Nginx

RUN ./configure --prefix=/usr/local/Nginx --user=Nginx --group=Nginx --with-http_stub_status_module --add-module=/usr/src/ngx_openresty/ngx_devel_kit --add-module=/usr/src/ngx_openresty/array-var-Nginx-module --add-module=/usr/src/ngx_openresty/headers-more-Nginx-module --add-module=/usr/src/ngx_openresty/rds-csv-Nginx-module --add-module=/usr/src/ngx_openresty/auth-request-Nginx-module --add-module=/usr/src/ngx_openresty/iconv-Nginx-module --add-module=/usr/src/ngx_openresty/memc-Nginx-module --add-module=/usr/src/ngx_openresty/rds-json-Nginx-module --add-module=/usr/src/ngx_openresty/redis2-Nginx-module --add-module=/usr/src/ngx_openresty/set-misc-Nginx-module --add-module=/usr/src/ngx_openresty/echo-Nginx-module --add-module=/usr/src/ngx_openresty/srcache-Nginx-module --add-module=/usr/src/ngx_openresty/encrypted-session-Nginx-module --add-module=/usr/src/ngx_openresty/form-input-Nginx-module --add-module=/usr/src/ngx_openresty/xss-Nginx-module --add-module=/usr/src/ngx_openresty/ngx_lua/ --with-http_ssl_module --add-module=/usr/src/ngx_openresty/ipseek --with-http_image_filter_module && make && make install

RUN wget https://files.cnblogs.com/files/blog-lhong/ngservice.sh -O /etc/init.d/Nginx
RUN chmod 755 /etc/init.d/Nginx
RUN chkconfig --add Nginx

RUN egrep -v '#|^$' /usr/local/Nginx/conf/Nginx.conf.default >/usr/local/Nginx/conf/Nginx.conf
RUN mkdir -p /usr/local/Nginx/conf/conf.d && sed -i '/server {/ i include conf/conf.d\/\*.conf;' /usr/local/Nginx/conf/Nginx.conf
RUN mkdir -p /data/html

EXPOSE 80
CMD ["/usr/local/Nginx/sbin/Nginx","-g","daemon off;"]
EOF

##############################################
mkdir -p /data/Nginx/{Conf.d,html}

cat >docker-compose.yml <<EOF
version: "3"
services:
  Nginx:
    build: Nginx/
    ports:
      - "80:80"
    volumes:
      - /data/Nginx/conf.d:/usr/local/Nginx/conf/conf.d
      - /data/Nginx/html:/data/html
EOF

#############################
docker-compose -f docker-compose.yml up -d

#############################构建镜像
docker build composetest/Nginx/ -t Nginx:v1.0.8

@H_419_0@?

本站总结

以上是本站教程为你收集整理的docker-compose 创建nginx全部内容,希望文章能够帮你解决docker-compose 创建nginx所遇到的程序开发问题。

如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。