优化聊天室首屏和在线名单性能
This commit is contained in:
@@ -35,6 +35,41 @@ map $http_upgrade $connection_upgrade {
|
||||
# try_files $uri $uri/ /index.php?$query_string;
|
||||
# }
|
||||
|
||||
# ── Vite 静态资源缓存(文件名带 hash,可安全长期缓存)────────────
|
||||
location ^~ /build/assets/ {
|
||||
access_log off;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# ── 常规静态资源缓存(不带 hash,保守缓存 7 天)───────────────
|
||||
location ~* \.(?:css|js|mjs|png|jpg|jpeg|gif|webp|svg|ico|woff2?|ttf|eot)$ {
|
||||
access_log off;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# ── 传输压缩:宝塔若已全局开启,可保持全局配置,不必重复添加 ──────
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 1024;
|
||||
gzip_vary on;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/json
|
||||
application/xml
|
||||
image/svg+xml;
|
||||
|
||||
# 如果服务器已安装 ngx_brotli,可启用以下配置获得更高压缩率:
|
||||
# brotli on;
|
||||
# brotli_comp_level 5;
|
||||
# brotli_types text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml;
|
||||
|
||||
# ⚡ WebSocket 反向代理(核心配置 - 必须添加!)
|
||||
# Laravel Reverb 监听在 127.0.0.1:8080
|
||||
# 浏览器通过 /app 和 /apps 路径发起 WebSocket 连接
|
||||
@@ -112,6 +147,26 @@ map $http_upgrade $connection_upgrade {
|
||||
# include /www/server/panel/vhost/rewrite/chat.ay.lc.conf;
|
||||
# #REWRITE-END
|
||||
#
|
||||
# location ^~ /build/assets/ {
|
||||
# access_log off;
|
||||
# expires 1y;
|
||||
# add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||
# try_files $uri =404;
|
||||
# }
|
||||
#
|
||||
# location ~* \.(?:css|js|mjs|png|jpg|jpeg|gif|webp|svg|ico|woff2?|ttf|eot)$ {
|
||||
# access_log off;
|
||||
# expires 7d;
|
||||
# add_header Cache-Control "public, max-age=604800" always;
|
||||
# try_files $uri =404;
|
||||
# }
|
||||
#
|
||||
# gzip on;
|
||||
# gzip_comp_level 5;
|
||||
# gzip_min_length 1024;
|
||||
# gzip_vary on;
|
||||
# gzip_types text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml;
|
||||
#
|
||||
# # ⚡⚡⚡ 在这里插入 WebSocket 反向代理 ⚡⚡⚡
|
||||
# location /app {
|
||||
# proxy_pass http://127.0.0.1:8080;
|
||||
|
||||
Reference in New Issue
Block a user