Fresh Magento 2安装仅显示没有样式的HTML内容

时间:2017-01-12 09:25:39

标签: magento nginx magento2

我刚刚完成了一个新的Magento 2安装而没有任何错误,但是当我转到主页或/ admin页面时,我只看到没有任何样式的HTML内容。

知道为什么吗?我使用与Magento 1相同的nginx配置,工作正常。

  • PHP 7.0.8
  • 的nginx / 1.10.0
  • MySQL 5.7.16

首页:

hope page

控制台错误:

console errors

nginx config:

server {
 root      /var/www/html/magento2/;
 index     index.php;
 server_name    magento2.dev;
 location / {
   index index.html index.php;
   try_files $uri $uri/ @handler;
   expires 30d;
 }
 location ~ ^/(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
 location /var/export/ { internal; }
 location /. { return 404; }
 location @handler { rewrite / /index.php; }
 location ~* .php/ { rewrite ^(.*.php)/ $1 last; }
 location ~* .php$ {
   if (!-e $request_filename) { rewrite / /index.php last; }
   expires off;
   fastcgi_pass unix:/run/php/php7.0-fpm.sock;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   fastcgi_param MAGE_RUN_CODE default;
   fastcgi_param MAGE_RUN_TYPE store;
   include fastcgi_params;
 }
}

修改

当我进入/ admin页面时,现在搞乱了它我得到了这个:

处理您的请求时出错

出于安全原因,默认情况下禁用异常打印。

错误日志记录号:846002728319

2 个答案:

答案 0 :(得分:0)

您应该通过运行php bin/magento setup:static-content:deploy来部署静态内容。

我相信这一步是在Magento的安装说明中。

此外,您应该确保您的文件具有正确的所有权和权限,以便Web服务器可以访问它们。要确保一切正确(如果您的Web服务器以www-data运行),请在控制台中打开Magento目录并键入:

chown www-data:www-data -R *

这应该将所有文件的所有权更改为Web服务器。

答案 1 :(得分:0)

我重新安装它,现在很好,但是有一个新问题。当我转到产品 - >目录 - >添加产品时我得到"处理您的请求时遇到错误"。

以下是来自/ var / report /:

的报告
a:4:{i:0;s:120:"Can't create directory /var/www/html/magento2/var/generation/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice/.";i:1;s:9392:"#0 /var/www/html/magento2/lib/internal/Magento/Framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\\Catalog...')
#1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\\Catalog...')
#2 [internal function]: spl_autoload_call('Magento\\Catalog...')
#3 /var/www/html/magento2/lib/internal/Magento/Framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\\Catalog...')
#4 /var/www/html/magento2/lib/internal/Magento/Framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\\Catalog...')
#5 /var/www/html/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\\Catalog...')
#6 /var/www/html/magento2/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Catalog...', Array)
#7 /var/www/html/magento2/lib/internal/Magento/Framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Catalog...', Array)
#8 /var/www/html/magento2/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php(547): Magento\Framework\Validator\UniversalFactory->create('Magento\\Catalog...')
#9 /var/www/html/magento2/var/generation/Magento/Catalog/Model/ResourceModel/Eav/Attribute/Interceptor.php(1103): Magento\Eav\Model\Entity\Attribute\AbstractAttribute->getBackend()
#10 /var/www/html/magento2/app/code/Magento/Catalog/Model/Attribute/ScopeOverriddenValue.php(127): Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor->getBackend()
#11 /var/www/html/magento2/app/code/Magento/Catalog/Model/Attribute/ScopeOverriddenValue.php(104): Magento\Catalog\Model\Attribute\ScopeOverriddenValue->initAttributeValues('Magento\\Catalog...', Object(Magento\Catalog\Model\Product\Interceptor), 0)
#12 /var/www/html/magento2/app/code/Magento/Catalog/Model/AbstractModel.php(325): Magento\Catalog\Model\Attribute\ScopeOverriddenValue->getDefaultValues('Magento\\Catalog...', Object(Magento\Catalog\Model\Product\Interceptor))
#13 /var/www/html/magento2/var/generation/Magento/Catalog/Model/Product/Interceptor.php(2026): Magento\Catalog\Model\AbstractModel->getAttributeDefaultValue('links_title')
#14 /var/www/html/magento2/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/UsedDefault.php(84): Magento\Catalog\Model\Product\Interceptor->getAttributeDefaultValue('links_title')
#15 /var/www/html/magento2/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/UsedDefault.php(66): Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\UsedDefault->titleUsedDefault('links_title')
#16 /var/www/html/magento2/app/code/Magento/Downloadable/Ui/DataProvider/Product/Form/Modifier/Composite.php(81): Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\UsedDefault->modifyMeta(Array)
#17 /var/www/html/magento2/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/ProductDataProvider.php(68): Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Composite->modifyMeta(Array)
#18 /var/www/html/magento2/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php(270): Magento\Catalog\Ui\DataProvider\Product\Form\ProductDataProvider->getMeta()
#19 /var/www/html/magento2/lib/internal/Magento/Framework/View/Element/UiComponentFactory.php(165): Magento\Framework\View\Element\UiComponentFactory->mergeMetadata('product_form', Array, false)
#20 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout/Generator/UiComponent.php(128): Magento\Framework\View\Element\UiComponentFactory->create('product_form', NULL, Array)
#21 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout/Generator/UiComponent.php(93): Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(Object(Magento\Framework\View\Layout\Data\Structure), 'product_form', Array, Object(Magento\Framework\View\Layout\Interceptor))
#22 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout/GeneratorPool.php(86): Magento\Framework\View\Layout\Generator\UiComponent->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#23 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout.php(344): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#24 /var/www/html/magento2/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): Magento\Framework\View\Layout->generateElements()
#25 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#26 /var/www/html/magento2/lib/internal/Magento/Framework/View/Page/Builder.php(55): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#27 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()
#28 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout.php(254): Magento\Framework\View\Layout\Builder->build()
#29 /var/www/html/magento2/lib/internal/Magento/Framework/View/Layout.php(876): Magento\Framework\View\Layout->build()
#30 /var/www/html/magento2/var/generation/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('menu')
#31 /var/www/html/magento2/app/code/Magento/Backend/Model/View/Result/Page.php(59): Magento\Framework\View\Layout\Interceptor->getBlock('menu')
#32 /var/www/html/magento2/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): Magento\Backend\Model\View\Result\Page->setActiveMenu('Magento_Catalog...')
#33 /var/www/html/magento2/app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php(71): Magento\Backend\Model\View\Result\Page\Interceptor->setActiveMenu('Magento_Catalog...')
#34 /var/www/html/magento2/var/generation/Magento/Catalog/Controller/Adminhtml/Product/NewAction/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Product\NewAction->execute()
#35 /var/www/html/magento2/lib/internal/Magento/Framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->execute()
#36 /var/www/html/magento2/app/code/Magento/Backend/App/AbstractAction.php(227): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#37 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#38 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->___callParent('dispatch', Array)
#39 /var/www/html/magento2/app/code/Magento/Backend/App/Action/Plugin/Authentication.php(143): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#40 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#41 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#42 /var/www/html/magento2/var/generation/Magento/Catalog/Controller/Adminhtml/Product/NewAction/Interceptor.php(39): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->___callPlugins('dispatch', Array, NULL)
#43 /var/www/html/magento2/lib/internal/Magento/Framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\NewAction\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#44 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#45 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#46 /var/www/html/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#47 /var/www/html/magento2/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#48 /var/www/html/magento2/lib/internal/Magento/Framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#49 /var/www/html/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#50 /var/www/html/magento2/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#51 {main}";s:3:"url";s:114:"/admin/catalog/product/new/set/4/type/simple/key/df823cdbaa5b3bda18ae44fac1fea1d1132f696eda5dbd07f2bd7ca7ffa18f9e/";s:11:"script_name";s:10:"/index.php";}