Skip to content

Instantly share code, notes, and snippets.

@asfo
Created March 7, 2018 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asfo/b3d7a33fef3346a3117dfb7cd41384e5 to your computer and use it in GitHub Desktop.
Save asfo/b3d7a33fef3346a3117dfb7cd41384e5 to your computer and use it in GitHub Desktop.
Dockerfile para Nginx
FROM ubuntu
MAINTAINER Asfo "asfoone@gmail.com"
ENV NGINX_VERSION 1.13.4
RUN apt-get update && apt-get install -y ca-certificates build-essential wget libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
RUN wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz \
&& tar -xvzf openssl-1.0.2d.tar.gz \
&& cd openssl-1.0.2d \
&& ./config \
--prefix=/usr \
--openssldir=/usr/ssl \
&& make && make install \
&& ./config shared \
--prefix=/usr/local \
--openssldir=/usr/local/ssl \
&& make clean \
&& make && make install
RUN wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
&& tar -xzvf nginx-${NGINX_VERSION}.tar.gz
COPY conf /nginx-${NGINX_VERSION}/auto/lib/openssl/
RUN cd nginx-${NGINX_VERSION} \
&& ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_ssl_module \
--with-http_v2_module \
--with-openssl=/usr \
--with-http_realip_module \
--with-http_stub_status_module \
--with-threads \
--with-ipv6 \
&& make \
&& make install
RUN apt-get autoremove -y
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME ["/var/cache/nginx"]
RUN rm -v /etc/nginx/nginx.conf
ADD nginx.conf /etc/nginx/
ADD blockips.conf /etc/nginx/
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Certificados en caso de que los tengas para soporte HTTPS + HTTP2
#COPY server.key /etc/nginx/ssl/
#COPY server.crt /etc/nginx/ssl/
EXPOSE 80 443
CMD nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment