server { listen [::]:80 default_server; listen 80 default_server; server_name _; root /var/www/static-files; # gzip gzip_disable "msie6"; gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; # allow safe files location ~* \.(?:css(\.map)?|js(\.map)?|ttf|ttc|otf|eot|woff2?|svgz?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv|pdf|docx?|dotx?|docm|dotm|xlsx?|xltx?|xlsm|xltm|pptx?|potx?|pptm|potm|ppsx?)$ { add_header Access-Control-Allow-Origin "*"; add_header Cache-Control "public"; expires 30d; access_log off; } # single page application location / { try_files $uri $uri/ /index.html; } }