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