Last active
June 12, 2019 09:18
-
-
Save dolegi/7dfc4255d844aeffe4698688c04f248c to your computer and use it in GitHub Desktop.
dockerized nginx static file server with subdomain dynamic routing and gzip compression
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
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; | |
} | |
} |
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 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 |
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
127.0.0.1 one.dlg.com | |
127.0.0.1 two.dlg.com |
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
<h1>one</h1> |
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
<h1>two</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment