Installing magento 2 does not deploy the /pub/static/frontend and backend

為{幸葍}努か 提交于 2019-12-01 03:08:00

An easier would be to run below command from magento root folder.

php bin/magento setup:static-content:deploy

This will feed the content perfectly in respective folders. If you have specific language then run like below.

php bin/magento setup:static-content:deploy en_US
php bin/magento setup:static-content:deploy en_GB

You get 404 responses probably because you don't have mod_rewrite enabled. You should enable it. But it can work without it. There is a 'cache' system for these static resources. navigate to the folder dev/tools/Magento/Tools/View and run this in the command line

php deploy.php

It works perfect. But still if you have issues then let me know.

------ EDIT ------

Edit as per the Chirag Bhavsar's answer.Enter below command from root of the Magento folder. New command will be

php bin/magento setup:static-content:deploy

The static content deploy process is described as below:

1) Delete adminhtml,frontend and _requirejs folders from pub/static folder.

2) Please don't delete the .htacces file in that pub/static folder.

3) Delete all folders in the directory var/cache.

4) Give 777 permission to both pub and var folders.

5) Run the command:

php bin/magento setup:static-content:deploy

When installing Magento 2.1.4 from scratch I also confronted with permissions problems and CSS and JS not loading in the page because they were not found by the server although I just ran

php bin/magento setup:static-content:deploy

and

php bin/magento cache:clean

It turned out that this setting is needed in the database to access the CSS and JS and have the site loading after first magento2 install.

insert core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0); 

This seemed to be the only sollution to have the site up and working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!