51e6aaec6a
* fix: cache with index.html * fix: docker build
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /app/nocobase/packages/app/client/dist;
|
|
index index.html;
|
|
client_max_body_size 20M;
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
# 不缓存 HTML 文件
|
|
location ~ \.html$ {
|
|
if_modified_since off;
|
|
expires off;
|
|
etag off;
|
|
}
|
|
|
|
# 缓存 JavaScript 和 CSS 文件
|
|
location ~* \.(js|css)$ {
|
|
expires 365d;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
location /storage/uploads/ {
|
|
alias /app/nocobase/storage/uploads/;
|
|
add_header Cache-Control "public";
|
|
access_log off;
|
|
autoindex off;
|
|
}
|
|
|
|
location / {
|
|
root /app/nocobase/packages/app/client/dist;
|
|
try_files $uri $uri/ /index.html;
|
|
add_header Last-Modified $date_gmt;
|
|
add_header Cache-Control 'no-store, no-cache';
|
|
if_modified_since off;
|
|
expires off;
|
|
etag off;
|
|
}
|
|
|
|
location ^~ /api/ {
|
|
proxy_pass http://127.0.0.1:13000/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
proxy_connect_timeout 600;
|
|
proxy_send_timeout 600;
|
|
proxy_read_timeout 600;
|
|
send_timeout 600;
|
|
}
|
|
}
|