I
I
Ivan Ivanov2019-06-19 00:31:23
FTP
Ivan Ivanov, 2019-06-19 00:31:23

Why is a small .js file fully uploaded via ftp only on the nth try?

The site has somefile.js file with a little javascript code. So, when I make edits in it on the local computer and upload it to the server with the site, the file is very often not uploaded to the end - the last few lines are cut off, a few letters, in different ways. I check through chrome with disabled caching.
I tried uploading this file using phpStorm, Filezilla, Dreamweaver - the result is the same. At the same time, there are no problems with uploading php and css files to the server.
somefile.js fills up completely after a few attempts.
The problem is directly with this file (and, as it turned out, other .js files) and directly with this server (everything is uploaded to other servers normally). ps Someone voted that the question is simple, why then there is still no answer? ..
What could be the problem? Thank you.
debian server OS, VestaCP.

pps Some mysticism is going on. I upload the file, open the file without caching through the browser, the last characters of the file are not visible. Through filezilla I download the file from the server, open it, look - the whole file, whole. After about a minute I refresh the page in the browser - the file is intact. Tried in opera and chrome.
I suspect that the answer is in the nginx settings - apparently it does not completely return the file...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Ivanov, 2021-10-10
@romalu

Apparently, it's all about the nginx caching settings - set it in the /etc/nginx/nginx.conf file open_file_cache Sets the cache in which they can be stored:
open_file_cache_valid 5s;

  • descriptors of open files, information about their size and modification time;
  • information about the existence of directories;
  • information about file search errors - “no file”, “no rights to read” and the like.

As you can see, the file size is cached, and when new lines are added to it, the file is not displayed completely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question