Skip to content

Instantly share code, notes, and snippets.

@ayxos
Created April 16, 2020 09:12
Show Gist options
  • Save ayxos/b530b4144cc71ac81026ed2aebb518e5 to your computer and use it in GitHub Desktop.
Save ayxos/b530b4144cc71ac81026ed2aebb518e5 to your computer and use it in GitHub Desktop.
React Nginx Docker
version: '3'
services:
nginx:
image: nginx:alpine
ports:
- "4040:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./dist:/usr/share/nginx/html
events {
worker_connections 2048; ## Default: 1024
}
http {
include mime.types;
types {
font/woff2 woff2;
}
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
##
# `gzip` Settings
#
#
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
expires 7d;
}
location / {
try_files $uri /index.html =404;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment