This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateTimeExtensions | |
{ | |
public static long ToUnixTime(this DateTime datetime) | |
{ | |
DateTime epochDate = new DateTime(1970, 1, 1,0,0,0,DateTimeKind.Utc); | |
return (long)(datetime - epochDate).TotalSeconds; | |
} | |
public static long ToJavaTime(this DateTime datetime) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
error_log logs/error.log %%NGX_LOGLEVEL%%; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN apt-get -y update && apt-get install -y \ | |
wget \ | |
build-essential \ | |
libpcre3-dev \ | |
zlib1g-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV NGINX_VERSION=1.11.12 | |
ENV NPS_VERSION=1.11.33.5 | |
ENV PSOL_VERSION=1.11.33.4 | |
ENV SUBS_VERSION=0.6.4 | |
# Criamos a pasta que conterá o nosso código fonte. | |
RUN ["mkdir","/usr/nginx_source/"] | |
WORKDIR "/usr/nginx_source/" | |
# Baixamos o código do Nginx da versão que selecionamos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compilando o Nginx | |
WORKDIR "/usr/nginx_source/nginx-$NGINX_VERSION/" | |
RUN ./configure \ | |
--add-module=/usr/nginx_source/ngx_pagespeed-latest-stable \ | |
--add-module=/usr/nginx_source/ngx_http_substitutions_filter_module-$SUBS_VERSION | |
RUN make | |
RUN make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Removendo todo o código fonte baixado para a compilação. | |
RUN rm -rf /usr/nginx_source | |
# Limpando os pacotes desnecessários para e execução do container. | |
RUN apt-get purge -y \ | |
wget \ | |
build-essential \ | |
libpcre3-dev \ | |
zlib1g-dev \ | |
&& apt-get autoremove -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Estas são as configurações que utilizamos no nginx. | |
ENV NGX_LOGLEVEL debug | |
ENV NGX_UPSTREAM_NAME www.google.com | |
ENV NGX_UPSTREAM_SERVER www.google.com:80 | |
# Estas são as configurações que utilizaremos no PageS | |
ENV NPS_ENABLED on | |
ENV NPS_LOWERCASEHTMLNAMES on | |
ENV NPS_RESPECTVARY off | |
ENV NPS_DISABLEREWRITEONNOTRANSFORM on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vamos copiar alguns arquivos para dentro do container. | |
COPY content/nginx.conf /usr/local/nginx/conf/ | |
COPY content/robots.txt /usr/local/nginx/html/ | |
# Estas linhas servem para que os logs do Nginx sejam apresentadas no console do container. | |
RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log | |
RUN ln -sf /dev/stderr /usr/local/nginx/logs/error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENTRYPOINT \sed -i 's/%%NGX_LOGLEVEL%%/'"$NGX_LOGLEVEL"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NGX_UPSTREAM_NAME%%/'"$NGX_UPSTREAM_NAME"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NGX_UPSTREAM_SERVER%%/'"$NGX_UPSTREAM_SERVER"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_ENABLED%%/'"$NPS_ENABLED"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_LOWERCASEHTMLNAMES%%/'"$NPS_LOWERCASEHTMLNAMES"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_ENABLEFILTERS%%/'"$NPS_ENABLEFILTERS"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_RESPECTVARY%%/'"$NPS_RESPECTVARY"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_DISABLEREWRITEONNOTRANSFORM%%/'"$NPS_DISABLEREWRITEONNOTRANSFORM"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
sed -i 's/%%NPS_MODIFYCACHINGHEADERS%%/'"$NPS_MODIFYCACHINGHEADERS"'/g' /usr/local/nginx/conf/nginx.conf && \ | |
/usr/local/nginx/sbin/./nginx -g 'daemon off;'; |
OlderNewer