Files
shanxia2.0/生产环境部署/nginx-shanxia-miniprogram-static.conf
2026-07-11 17:15:17 +08:00

54 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 山峡化工 · 小程序静态资源(公网 CDN 目录)
#
# 服务器目录:/iflytek/shanxia2.0/app/assets
# 对外 URL 前缀:/shanxia-static/
#
# ── 部署方式(二选一)────────────────────────────────────────────
#
# 【推荐 A】挂到 shanxia2.0 门户 Nginx(9911)
# 将下方「location 块」合并进 生产环境部署/nginx-shanxia2.0.conf(已内置)
# 访问示例:http://121.43.228.102:9911/shanxia-static/images/logo.svg
#
# 【可选 B】挂到 CRM 主站 Nginx(80 / crm.shanxiachem.com)
# 将下方「location 块」粘贴进 /etc/nginx/conf.d/web.conf
# 须放在 `location / { try_files ... }` 之前
# 访问示例:https://crm.shanxiachem.com/shanxia-static/images/logo.svg
# (小程序正式版建议走 HTTPS 域名,并在微信公众平台配置 downloadFile 合法域名)
#
# ── 上传资源 ────────────────────────────────────────────────────
# 本地 miniprogram/static/ → 服务器 /iflytek/shanxia2.0/app/assets/
#
# rsync 示例:
# rsync -avz --delete miniprogram/static/ root@121.43.228.102:/iflytek/shanxia2.0/app/assets/
#
# ── 生效 ────────────────────────────────────────────────────────
# nginx -t && nginx -s reload
#
# ── 自检 ────────────────────────────────────────────────────────
# curl -I http://121.43.228.102:9911/shanxia-static/images/logo.svg
# curl -I http://121.43.228.102:9911/shanxia-static/health
# ================================================================
# 复制以下 location 块到目标 server { ... } 内(SPA 兜底规则之前)
# ================================================================
# 小程序静态资源(图片 / 图标 / tabbar 等,不含业务 API)
location ^~ /shanxia-static/ {
alias /iflytek/shanxia2.0/app/assets/;
autoindex off;
expires 30d;
add_header Cache-Control "public, max-age=2592000";
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
if ($request_method = 'OPTIONS') {
return 204;
}
}
location = /shanxia-static/health {
access_log off;
default_type text/plain;
return 200 "shanxia miniprogram static ok\n";
}