The static image on the server cannot be updated, overwritten or deleted, and the original image is still displayed.

Server: Aliyun, lnmp1.4 version (centos7+nginx+mysql+php)

recently updated the static file of the website with ftp, found that after overwriting the old picture with the new picture, the foreground still displays the old picture, then deletes the picture on the server, and the foreground will still display.
after cleaning up the site cache and the local browser cache, it will still be displayed that sites with different frames have the same problem

what may be the reason

Virtual Machine profile:

server
    {
        listen 80;
        -sharplisten [::]:80;
        server_name www.domain.com domain.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.domain.com;
        
        include www.domain.com.conf;
        -sharperror_page   404   /404.html;
        location ~ [^/]\.php(/|$)
            {
                -sharp comment try_files $uri =404; to enable pathinfo
                try_files $uri =404;
                fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                -sharpinclude pathinfo.conf;
            }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
            {
                expires      30d;
            }

        location ~ .*\.(js|css)?$
            {
                expires      12h;
            }

        access_log  /home/wwwlogs/www.domain.com.log  access;
    }

I can change 30d to 0d, or delete location ~ directly, and then restart nginx,.

Mar.01,2021

nginx in lnmp environment is cached for 30 days by default. You send out the nginx virtual host configuration ( / usr/local/nginx/conf/vhosts/ directory )


have you solved this problem


final reason:
because Baidu Cloud acceleration was previously used on the site, although the pictures were deleted locally, they are still available on Baidu CDN, so the images distributed by Baidu CDN are displayed on the open web page.

solution: disable Baidu Cloud acceleration, and that's fine.

(or clean up Baidu CDN, but I haven't tried, because I want to add https, to the website, the free version of Baidu Cloud acceleration doesn't support https, so I just shut down Baidu Cloud acceleration
.
Menu