Problem:

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.

Questions

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?

share|improve this question
    
try this magento.stackexchange.com/questions/96289/… – Kothari May 23 '16 at 5:16
    
In magento2 the permission are very closely maintained you can try out the steps mentioned in devdocs.magento.com/guides/v2.0/install-gde/prereq/… and see if it helps – Atish Goswami May 23 '16 at 5:58
    
Solve it! Update into 2.0.6 and those problems gone. Thanks for the advice tho – Orochi May 24 '16 at 13:37

You can run the following command

php bin/magento setup:static-content:deploy
share|improve this answer

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.

share|improve this answer
php bin/magento setup:static-content:deploy

remove var/view_preprocessed folder

share|improve this answer

Update to the latest version solve this problem.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Klettseb Jun 2 '16 at 6:26
    
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. – Fabian Schmengler Jun 2 '16 at 6:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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