I am installing Magento 2 on live server. While the site displays product info and some of the product images, there are no styles and JavaScript functions don't work.

Solution attempts/debugging:

I have seen a number of articles on inaccessible css/js files and have tried what they suggested to no avail. I follow instructions from here: https://mage2.pro/t/topic/259. But still no luck.

i've tried suggestion from Sandeep Pandey in https://mage2.pro/t/topic/259, it manage to solve the problem at first, but then when i change logo of my website or add new product, the problem occur again, the css and js wont load.


Does anyone have any ideas for solving this problem? Should i run command chmod 777 var -R & chmod 777 pub -R everytime i made changes on my website? Any suggestion?


4 Answers 4


You can run the following command

php bin/magento setup:static-content:deploy

There are 2 methods to solve it:

  • Using command:

    1. Open terminal and cd to magento installation directory.

    2. Run below command:

    php bin/magento setup:static-content:deploy

  • Manual:

    1. Go to pub/static folder and remove everything, except .htaccess file.

    2. Open up app/etc/di.xml find the path Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy.

    3. Remove cache and reload frontend.

php bin/magento setup:static-content:deploy

remove var/view_preprocessed folder


Update to the latest version solve this problem.

  • This does not provide any explanation, but it's true, because in Magento 2.0.6 they made the file permissions less restrictive by default to address exactly this problem. Jun 2, 2016 at 6:44

Your Answer

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

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