Created
July 26, 2024 06:19
-
-
Save Wxh16144/f438f8a67dd97f54181e5b33abf742f7 to your computer and use it in GitHub Desktop.
Docker Nginx minimal configuration
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
# https://www.digitalocean.com/community/tools/nginx?global.app.lang=zhCN | |
server { | |
listen 80; | |
listen [::]:80; | |
root /usr/share/nginx/html; | |
location / { | |
index index.html index.htm; | |
try_files $uri /index.html =404; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
# assets, media | |
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ { | |
expires 7d; | |
} | |
# svg, fonts | |
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ { | |
add_header Access-Control-Allow-Origin "*"; | |
expires 7d; | |
} | |
# gzip | |
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; | |
} |
Author
Wxh16144
commented
Jul 26, 2024
- 如何压缩vue2.js为30kb? - Wxh16144的回答 - 知乎
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment