0

After i upgraded the magento 2 from 2.1 to 2.1.5, all can't be loaded

All css & javascript links are like this

http://example.com/pub/static/version1491232244/frontend/Magento/luma/en_US/css/styles-l.css 

with version1491232244, the path is wrong, if i remove version1491232244, the resource can be loaded, anyone know what is the problem?

it seems the nginx rewrite problem?

My current config:

    location /static/ {
            # Uncomment the following line in production mode
            # expires max;

            # Remove signature of the static files that is used to overcome the browser cache
            location ~ ^/static/version {
                    rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
            }

            location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
                    add_header Cache-Control "public";
                    add_header X-Frame-Options "SAMEORIGIN";
                    expires +1y;

                    if (!-f $request_filename) {
                            rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                    }
            }

            location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
                    add_header Cache-Control "no-store";
                    add_header X-Frame-Options "SAMEORIGIN";
                    expires    off;

                    if (!-f $request_filename) {
                       rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
                    }
            }

            if (!-f $request_filename) {
                    rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
            }

            add_header X-Frame-Options "SAMEORIGIN";
    }
hkguile
  • 2,221
  • 5
  • 45
  • 85
  • Does the value in /versionXXXX/ matches value in $MAGENTO_ROOT/pub/static/deployed_version.txt, you can try going to http://youdomain.com/static/deployed_version.txt – Zefiryn Apr 03 '17 at 21:43
  • You can try to disable static files versioning in Stores > Configuration > Advanced > Developers > Static Files Settings > Sign Static Files – Zefiryn Apr 03 '17 at 21:49
  • i've checked the value is not match, but i changed the right number it is still 404 – hkguile Apr 04 '17 at 03:40
  • Take a look here: http://magento.stackexchange.com/a/162210/33057 – Khoa TruongDinh Apr 04 '17 at 05:37

0 Answers0