Whenever I make any change to CSS of my Magento store, it doesn't seem to be updated.

I also tried to clean the cache from the Magento admin dashboard but it didn't work.

Now I always have to run the following commands via putty.

  1. sudo php bin/magento setup:upgrade
  2. sudo php -dmemory_limit=4G bin/magento setup:static-content:deploy
  3. sudo php bin/magento cache:clean
  4. sudo php bin/magento cache:flush
  5. sudo chmod -R 777 var

Server - EC2 (Amazon AWS)

Please help!


1 Answer 1


It's (unfortunately) the way Magento 2 works.

If you're in developer or default mode, you can Flush static files and refresh the cache from your admin (there are buttons for each in cache management).

But if you're in production, then you need to run

php bin/magento setup:static-content:deploy

But you need to be logged in as the owner of your server. In other words, don't log into CLI as root.

Since you are on shared hosting, you also shouldn't use sudo for this command, because that changes the ownership of all your static content files to the root user and then you can't load the website without giving 777 permissions on all the static files (which is something you definitely shouldn't do).

Also if you're in production, you need to run

php bin/magento cache:flush

after static content is flushed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.