25 lines
626 B
Nginx Configuration File
25 lines
626 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# 启用 gzip
|
|
gzip on;
|
|
gzip_comp_level 6;
|
|
gzip_min_length 1000;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
gzip_vary on;
|
|
|
|
# 支持 Vue Router 的 history 模式
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 缓存静态资源
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
} |