standalone-8091.conf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # =============================================================================
  2. # 伟星净水官网静态镜像 - 独立 8091 端口配置(最简部署)
  3. #
  4. # 最简方式:无需 HTTPS、无需域名,一个 server 块即可对外提供访问。
  5. # 访问地址:http://<host>:8091/
  6. #
  7. # 部署步骤:
  8. # 1. 复制本文件到 nginx 配置目录:
  9. # Debian/Ubuntu: /etc/nginx/conf.d/
  10. # 宝塔面板: /www/server/panel/vhost/nginx/
  11. # 2. 把下方 root 改为你克隆本仓库后的实际路径
  12. # 3. nginx -t && nginx -s reload
  13. # 4. 放行防火墙 8091 端口
  14. #
  15. # 来源:https://jingshui.vasen.com/ 镜像(2026-08-14 抓取)
  16. # 性质:Vite 构建的 Vue SPA,hash 路由,纯前端无后端 API
  17. # =============================================================================
  18. server {
  19. listen 8091;
  20. server_name _;
  21. # ★ 改为你克隆仓库后的实际路径
  22. root /path/to/jingshui;
  23. index index.html;
  24. charset utf-8;
  25. access_log /var/log/nginx/jingshui.log;
  26. error_log /var/log/nginx/jingshui.error.log;
  27. # hash 路由 SPA:文件不存在时回退首页(保险)
  28. location / {
  29. try_files $uri $uri/ /index.html;
  30. }
  31. # HTML 不缓存,便于修改即时生效
  32. location ~* \.html?$ {
  33. add_header Cache-Control "no-cache, must-revalidate";
  34. expires off;
  35. }
  36. # 静态资源长缓存(资源均带 hash,可放心长缓存;含视频)
  37. location ~* \.(js|css|svg|ico|png|jpg|jpeg|gif|woff2?|ttf|eot|mp4)$ {
  38. expires 30d;
  39. add_header Cache-Control "public";
  40. access_log off;
  41. }
  42. # 健康检查
  43. location = /healthz {
  44. add_header Content-Type text/plain;
  45. return 200 "ok\n";
  46. access_log off;
  47. }
  48. # 安全:禁止访问隐藏文件
  49. location ~ /\. {
  50. deny all;
  51. }
  52. }