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
相关推荐
似的8354 小时前
一步一步学习使用FireMonkey动画() 使用TAnimator类创建动画
linux·学习·nginx
郭老二4 小时前
【前端】vue3:编译步骤
前端
不在逃避q5 小时前
Trae/Vs Code/Cursor命令行无法跑npm命令
前端·arcgis·npm
夏殇之殁5 小时前
包中创建自定义列表项。 . 使用自定义列表项进行数据绑定 . 将天气预报数据保存到本地内存表,通过LiveBindings进行显示。 ...
服务器·前端·javascript
The Chosen One9855 小时前
高进度算法模板速记(待完善)
java·前端·算法
陈随易5 小时前
MoonBit抓包模块pcap,查看电脑的每一次联网通信
前端·后端·程序员
新中地GIS开发老师6 小时前
WebGIS开发学生作品|低空航天管理与航线规划系统
前端·javascript·webgis·三维gis开发
用户059540174467 小时前
大模型对话记忆持久化踩坑实录:用 Playwright 自动化测了 300 次,终于揪出会话丢失的真凶
前端·css
丙氨酸長鏈7 小时前
Web前端入门第 问:JavaScript 一个简单的 IndexedDB 数据库入门示例
前端·javascript·数据库
kyriewen8 小时前
面试官让我手写虚拟列表——AI生成的版本,快速滚动几下就白屏了
前端·javascript·面试