It takes too long for browsers to access online web project CSS and JS files to load. What is the reason?

Server environment: Ali Cloud centos7.4 nginx1.14 php7.2 mysql5.7

there is no problem for the project to run locally and load quickly, but after deployment to the server, access to the web project on the server, when the browser clears the cache, some js files on the page will be loaded for 40s, and the second visit will be soon, and then clearing the cache will load for a long time. Is it the reason for not compressing the CSS and js files? But the local code is the same, and it loads very quickly.

Dec.15,2021

there is a problem with the server. The bandwidth may be too small or the server is abroad.
there is no bandwidth limit locally, because resources are loaded very quickly because they do not go to the public network.
the second time online, static resources actually use the previous cache (if no random strings are added to static resource requests), thus saving time for downloading resources and will be faster.


solution:

  1. Compression
  2. Open gzip
  3. put it on cdn

the difference of 40s should not be the reason why there is no compression.

Menu