FROM centos:7
ENV NGINX_VERSION 1.18.0
ADD nginx-$NGINX_VERSION.tar.gz /usr/local/
RUN yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel libxslt-devel -y gd gd-devel GeoIP GeoIP-devel pcre pcre-devel && \
useradd -M -s /sbin/nologin nginx
WORKDIR /usr/local/nginx-$NGINX_VERSION
RUN ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module && make && make install
ENV PATH /usr/local/nginx/sbin:$PATH
EXPOSE 80
--------------------------------------------------------------
FROM nginx:v1
ENV NGINX_DIR /usr/local/nginx/conf
ENV NGINX_CODE /usr/local/nginx/html
COPY nginx.conf $NGINX_DIR
RUN mkdir -pv $NGINX_DIR/vhost
COPY index.html $NGINX_CODE/
COPY adv.conf $NGINX_DIR/vhost/
ENV PATH /usr/local/nginx/sbin:$PATH
ENTRYPOINT ["nginx"]
CMD ["-g","daemon off;"]