Why is nginx holding the map file?

  • 0
    A directory contains the files bootstrap.min.css and bootstrap.min.css.map . Using javascript, these files are transferred from one directory to another, and the second is cleared beforehand.
    This happens on a virtual machine, in "shared folders". At the first start of the virtual machine, the script is successful, but the next time an error is generated
    Error: ETXTBSY: text file is busy, unlink '/path/to/bootstrap.min.css.map'

    See who is busy with this file
    [[email protected]]# lsof ./path/to/bootstrap.min.css.map 
    nginx   3559 nginx   24r   REG   0,42   646986 10378 ./path/to/bootstrap.min.css.map

    kill -9 3559 helps. But what is the mistake, how to do without it?

    user nginx vboxsf;
    worker_processes 2;
    pid /run/nginx.pid;
    include /usr/share/nginx/modules/*.conf;
    events {
        worker_connections 1024;
        multi_accept on;
    http {
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
        access_log  off;
        error_log   /var/log/nginx/error.log crit;
        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        types_hash_max_size 2048;
        include             /etc/nginx/mime.types;
        default_type        text/html;
        charset             UTF-8;
        keepalive_timeout     20;
        client_header_timeout 20;
        client_body_timeout   20;
        send_timeout          20;
        reset_timedout_connection on;
        gzip  on;
        gzip_buffers 16 8k;
        gzip_comp_level 6;
        gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_proxied any;
        gzip_vary on;
          text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
          text/javascript application/javascript application/x-javascript
          text/x-json application/json application/x-web-app-manifest+json
          text/css text/plain text/x-component
          font/opentype application/x-font-ttf application/vnd.ms-fontobject
        gzip_disable "msie6";
        open_file_cache max=65000 inactive=20s;
        open_file_cache_valid 30s;
        open_file_cache_min_uses 2;
        open_file_cache_errors on;
    server {
        server_name  some.name;
        root         /some/path/;
        access_log   off;
        error_log    /var/log/nginx/some..error.log;
        # Cache images 1 year
        location ~* \.(jpg|jpeg|gif|png|ico|woff|woff2)$ {
            access_log        off;
            log_not_found     off;
            expires           360d;
        # Don't store files log
        location ~* \.(css|js|xml)$ {
            access_log        off;
            log_not_found     off;
        # Exclude hidden directory
        location ~ /\. {
            access_log off;
            log_not_found off; 
            deny all;
        index index.php index.html;
        error_page 404 /index.php;
        location / {
            rewrite ^/(.*)/$ /$1 permanent;
            try_files $uri $uri/ /index.php?$query_string;
        location ~ \.php$ {
            rewrite ^/(.*)/$ /$1 permanent;
            server_tokens off;
            client_max_body_size 3m;
            client_body_buffer_size 128k;
            # regex to split $uri to $fastcgi_script_name and $fastcgi_path
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            # Check that the PHP script exists before passing it
            try_files $fastcgi_script_name =404;
            # Bypass the fact that try_files resets $fastcgi_path_info
            # see: http://trac.nginx.org/nginx/ticket/321
            set $path_info $fastcgi_path_info;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_index index.php;
            include fastcgi.conf;
            fastcgi_pass unix:/var/run/php-fpm/some.sock;
    Nginx Anonymous, Oct 3, 2019

  • 1 Answers
  • 0
    open_file_cache max=65000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    here we can store "descriptors of open files, information about their sizes and modification time". Try to disable.

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!