diff --git a/nginx/1.9.9/Dockerfile b/nginx/1.9.9/Dockerfile new file mode 100644 index 0000000..b509fe1 --- /dev/null +++ b/nginx/1.9.9/Dockerfile @@ -0,0 +1,27 @@ +FROM centos:7 + +MAINTAINER Yang + +ENV NGINX_VERSION=1.9.9 + +RUN yum install -y wget make gcc pcre-devel gzip zlib zlib-devel + +RUN cd / && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \ + && tar -zxvf nginx-$NGINX_VERSION.tar.gz \ + && rm -rf nginx-$NGINX_VERSION.tar.gz \ + && cd nginx-$NGINX_VERSION \ + && ./configure --prefix=/usr/local/nginx \ + && make \ + && make install \ + && cd .. \ + && rm -rf nginx-$NGINX_VERSION + +RUN mkdir -p /nginx/conf && mkdir /nginx/logs/ && mkdir /nginx/www + +EXPOSE 80 + +COPY start.sh / + +RUN chmod 777 /start.sh + +CMD ["/start.sh"] \ No newline at end of file diff --git a/nginx/1.9.9/start.sh b/nginx/1.9.9/start.sh new file mode 100644 index 0000000..64e50fe --- /dev/null +++ b/nginx/1.9.9/start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ ! -e /nginx/conf/nginx.conf ]; then + cp /usr/local/nginx/conf/nginx.conf /nginx/conf + sed -i "s/mime.types/\/usr\/local\/nginx\/conf\/mime.types/" /nginx/conf/nginx.conf +fi + +/usr/local/nginx/sbin/nginx -c /nginx/conf/nginx.conf -g 'daemon off;' \ No newline at end of file