Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dolegi
Last active June 12, 2019 09:18
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 dolegi/7dfc4255d844aeffe4698688c04f248c to your computer and use it in GitHub Desktop.
Save dolegi/7dfc4255d844aeffe4698688c04f248c to your computer and use it in GitHub Desktop.
dockerized nginx static file server with subdomain dynamic routing and gzip compression
server {
server_name ~^(?<subdomain>.+).dlg.com$ ;
root /usr/share/nginx/$subdomain;
listen 7070 http2;
gzip on;
gzip_disable "msie6";
gzip_min_length 0;
gzip_types *;
location / {
index index.html index.htm;
expires 7d;
}
}
FROM nginx:alpine
COPY default.conf /etc/nginx/conf.d/default.conf
RUN mkdir -p /usr/share/nginx/one
RUN mkdir -p /usr/share/nginx/two
COPY index.html /usr/share/nginx/one/index.html
COPY index2.html /usr/share/nginx/two/index.html
127.0.0.1 one.dlg.com
127.0.0.1 two.dlg.com
<h1>one</h1>
<h1>two</h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment