mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
Merge pull request #4737 from baozaodetudou/nginx
This commit is contained in:
+37
-29
@@ -9,35 +9,6 @@ location / {
|
|||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 图片类静态资源
|
|
||||||
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
}
|
|
||||||
|
|
||||||
# assets目录
|
|
||||||
location /assets {
|
|
||||||
expires 1y;
|
|
||||||
add_header Cache-Control "public, immutable";
|
|
||||||
}
|
|
||||||
|
|
||||||
# 站点图标
|
|
||||||
location /api/v1/site/icon/ {
|
|
||||||
# 站点图标缓存
|
|
||||||
proxy_cache my_cache;
|
|
||||||
# 缓存响应码为200和302的请求1小时
|
|
||||||
proxy_cache_valid 200 302 1h;
|
|
||||||
# 缓存其他响应码的请求5分钟
|
|
||||||
proxy_cache_valid any 5m;
|
|
||||||
# 缓存键的生成规则
|
|
||||||
proxy_cache_key "$scheme$request_method$host$request_uri";
|
|
||||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
||||||
|
|
||||||
# 向后端API转发请求
|
|
||||||
proxy_pass http://backend_api;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# 本地CookieCloud
|
# 本地CookieCloud
|
||||||
location /cookiecloud {
|
location /cookiecloud {
|
||||||
proxy_pass http://backend_api;
|
proxy_pass http://backend_api;
|
||||||
@@ -97,4 +68,41 @@ location /api {
|
|||||||
|
|
||||||
# 超时设置
|
# 超时设置
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ========= 静态资源缓存 =========
|
||||||
|
# 图片类静态资源
|
||||||
|
location ~* \.(png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# JS 和 CSS 静态资源缓存(排除 /api/v1 路径)
|
||||||
|
location ~* ^/(?!api/v1).*\.((js|css))$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
add_header Vary Accept-Encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
# assets目录
|
||||||
|
location /assets {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# 站点图标
|
||||||
|
location /api/v1/site/icon/ {
|
||||||
|
# 站点图标缓存
|
||||||
|
proxy_cache my_cache;
|
||||||
|
# 缓存响应码为200和302的请求1小时
|
||||||
|
proxy_cache_valid 200 302 1h;
|
||||||
|
# 缓存其他响应码的请求5分钟
|
||||||
|
proxy_cache_valid any 5m;
|
||||||
|
# 缓存键的生成规则
|
||||||
|
proxy_cache_key "$scheme$request_method$host$request_uri";
|
||||||
|
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||||
|
|
||||||
|
# 向后端API转发请求
|
||||||
|
proxy_pass http://backend_api;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user