html+nginx实现看板

1.效果

2.代码html

复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <title>数据监控看板</title>
  <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      background: #051224;
      padding: 20px;
      font-family: "Microsoft YaHei", sans-serif;
    }

    .title {
      text-align: center;
      font-size: 32px;
      color: #00e0ff;
      letter-spacing: 3px;
      margin-bottom: 20px;
      text-shadow: 0 0 15px #00e0ff;
    }

    #chart {
      width: 100%;
      height: 800px;
      border: 1px solid rgba(0, 224, 255, 0.3);
      border-radius: 12px;
      background: rgba(0, 20, 50, 0.4);
      backdrop-filter: blur(5px);
    }
  </style>
</head>

<body>
  <div class="title">一周数据统计大屏</div>
  <div id="chart"></div>

  <script>
    const myChart = echarts.init(document.getElementById('chart'));
    const week = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];

    // 生成80-160的随机数据
    function getRandomData() {
      return week.map(() => Math.floor(Math.random() * 80) + 80);
    }

    // 更新图表
    function updateChart() {
      const data = getRandomData();
      myChart.setOption({
        tooltip: {
          trigger: 'axis',
          backgroundColor: 'rgba(0, 10, 30, 0.9)',
          borderColor: '#00e0ff',
          textStyle: { color: '#fff' }
        },
        grid: {
          left: '5%',
          right: '5%',
          bottom: '5%',
          top: '5%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: week,
          axisLine: { lineStyle: { color: '#00e0ff' } },
          axisLabel: { color: '#fff', fontSize: 14 }
        },
        yAxis: {
          type: 'value',
          min: 0,
          max: 200,
          axisLine: { lineStyle: { color: '#00e0ff' } },
          splitLine: { lineStyle: { color: 'rgba(0,224,255,0.15)' } },
          axisLabel: { color: '#fff' }
        },
        series: [{
          type: 'bar',
          data: data,
          barWidth: '40%',
          itemStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              { offset: 0, color: '#00d2ff' },
              { offset: 1, color: '#0072ff' }
            ])
          }
        }]
      });
    }

    // 首次加载
    updateChart();
    // 每3秒自动刷新
    setInterval(updateChart, 3000);
  </script>
</body>
</html>

3.nginx.conf配置

复制代码
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log notice;
#error_log  logs/error.log info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       9999;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

4.Ngixn静默启动

复制代码
@echo off
chcp 437 >nul
cd /d "%~dp0"

echo Closing old Nginx...
taskkill /f /im nginx.exe >nul 2>&1
timeout /t 1 /nobreak >nul

echo Starting Nginx...
start nginx.exe

echo ======================================
echo  SUCCESS! Nginx is running
echo  Open your browser:
echo  http://localhost:9999
echo ======================================
pause
相关推荐
bcbobo21cn2 小时前
Web 3D 正方体贴图
前端·3d·贴图·mesh
聊聊MES那点事2 小时前
报表控件Stimulsoft Reports.NET使用教程:发票报告设计
前端·javascript·html·报表工具
予你@。2 小时前
Vue2 使用 html2canvas 将 HTML 生成图片并上传到服务器
前端·html
星晨雪海2 小时前
优惠券秒杀的核心业务逻辑
java·前端·数据库
Bigger2 小时前
第五章:我是如何剖析 Claude Code 的 MCP 服务与插件生态系统的
前端·ai编程·claude
许彰午2 小时前
# 政务表单动态建表?运行时DDL引擎,前端拖完字段后端直接建
java·前端·后端·架构·政务
San30.2 小时前
前端渲染:从 CSR、SSR 到同构与手写 Vite+React SSR 实践
前端·react.js·前端框架
三声三视2 小时前
React 19 正式发布!17 个新特性深度解析与迁移指南(2026 实战版)
前端·javascript·reactjs·react
滴滴答答哒2 小时前
c#将平铺列表转换为树形结构(支持孤儿节点作为独立根节点)
java·前端·c#