代码之家  ›  专栏  ›  技术社区  ›  user6456568

当使用nginx加载静态文件时,TTFB是6+秒

  •  1
  • user6456568  · 技术社区  · 6 年前

    nginx配置为:

    server {
       listen       80;
        server_name  127.0.0.1;
        location / {
            root   /var/www/project/dist;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;
        }
        location ^~/api/ { proxy_pass http://127.0.0.1:5438/api/; }
     }
    

    dist文件是

        dist/
        ├── [1.1K]  favicon.ico
        ├── [ 901]  index.html
        └── [441K]  static
           ├── [229K]  css
           │   ├── [189K]  app.0134d2dda560ad06a1485c5f69858798.css
           │   └── [ 36K]  app.0134d2dda560ad06a1485c5f69858798.css.gz
           ├── [ 15K]  fonts
           │   └── [ 11K]  element-icons.6f0a763.ttf
           └── [193K]  js
               ├── [ 53K]  app.ce2c95e6433bd8164fc4.js
               ├── [ 18K]  app.ce2c95e6433bd8164fc4.js.gz
               ├── [ 799]  manifest.2ae2e69a05c33dfc65f8.js
               ├── [ 88K]  vendor.78ce98b3a34633bdf003.js
               └── [ 29K]  vendor.78ce98b3a34633bdf003.js.gz
    

    0 回复  |  直到 6 年前