Magento2: CSS and JS files not loading - 404 Error- Magento 2 Nightmares

Created on 8 Dec 2015  Â·  7Comments  Â·  Source: magento/magento2

Hi Devs,

Kindly provide exact solution to JS and CSS files 404 errors. I followed installation guide and did 5 times installation still not able to fix the problem. Only bare pages are loading. Also please note many people struggling with the same issue https://community.magento.com/t5/Installing-Magento-2/bd-p/installing-magento-2. Appreciate proper guide on fixing 404 errors.

All 7 comments

Hi,
You can fix it by doing this command in your web directory :
php bin/magento setup:static-content:deploy

Looks like Ownership and permission issue. I have applied 777 for testing and it is working fine. thanks @oshanrube

Hi @rajeshmukkala http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache-user.html#install-update-depend-user-over. I close the Ticket now, if you have the feeling that is wrong please feel free to reopen.

@thienphucvx thanks! it worked

  1. Goto below path
sudo nano /etc/apache2/apache2.conf

and edit below one

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>
  1. Enable apache rewrite module and restart the server
sudo a2enmod rewrite
sudo service apache2 restart
  1. Clear the magento cache
php bin/magento cache:clean 
php bin/magento cache:flush

@ elangovanshanthi it works! i am apache2.2 , i change the syntex to

Order allow,deny
Allow from all

nginx的解决方法

Was this page helpful?
0 / 5 - 0 ratings