Magento Open Source 2.3 - CSS and JS not loading

狂风中的少年 提交于 2019-12-12 17:11:17

问题


I installed Magento 2.3 successfully but when type http://localhost/Magento2/, I get a blank page like this:

and these are the errors found in the console:

The same issue is also faced on the admin panel. My current version of PHP is 7.2.14.


回答1:


You cannot use http://localhost/ as domain name with Magento 2, you should at least use http://localhost.com/.

  1. Change your vHost in Docker/XAMP/MAMP/WAMP... to match your new domain name, for instance http://localhost.com/;

  2. Edit your hosts file with sudo permissions :

    • Debian / MacOS: /etc/hosts

    • Windows: C:\Windows\System32\drivers\etc\hosts

  3. At the bottom of the file, add the following: 127.0.0.1 localhost.com

  4. Go to your Magento db and run the following query :

UPDATE `core_config_data` SET `value`='http://localhost.com/' WHERE `value`='http://localhost/';
  1. Finally, with command line :
cd /YOUR/PROJECT/PATH
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
  1. Go to http://localhost.com/ (or http://localhost.com/Magento2/, according to your configuration), and check if everything works.


来源:https://stackoverflow.com/questions/54434779/magento-open-source-2-3-css-and-js-not-loading

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