We have configured Mago theme to our store in magento 2 and it is throwing error as described below:
Unable to write file into directory /usr/share/nginx/html/pub/media/catalog/product/cache/1/image/265x265/beff4985b56e3afdbeabfc89641a4582/u/s. Access forbidden. #0 /usr/share/nginx/html/vendor/magento/framework/Image/Adapter/Gd2.php(139): Magento\Framework\Image\Adapter\AbstractAdapter->_prepareDestination('/usr/share/ngin...', NULL) #1 /usr/share/nginx/html/vendor/magento/framework/Image.php(79): Magento\Framework\Image\Adapter\Gd2->save('/usr/share/ngin...', NULL) #2 /usr/share/nginx/html/vendor/magento/module-catalog/Model/Product/Image.php(698): Magento\Framework\Image->save('/usr/share/ngin...') #3 /usr/share/nginx/html/vendor/magento/module-catalog/Helper/Image.php(468): Magento\Catalog\Model\Product\Image->saveFile() #4 /usr/share/nginx/html/vendor/magento/module-catalog/Helper/Image.php(540): Magento\Catalog\Helper\Image->applyScheduledActions() #5 /usr/share/nginx/html/vendor/magento/module-catalog/Block/Product/ImageBuilder.php(132): Magento\Catalog\Helper\Image->getResizedImageInfo() #6 /usr/share/nginx/html/vendor/magento/module-catalog/Block/Product/AbstractProduct.php(507): Magento\Catalog\Block\Product\ImageBuilder->create() #7 [internal function]: Magento\Catalog\Block\Product\AbstractProduct->getImage(Object(Magento\Catalog\Model\Product\Interceptor), 'product_base_im...', Array) #8 /usr/share/nginx/html/vendor/magento/framework/Interception/Interceptor.php(144): call_user_func_array(Array, Array) #9 /usr/share/nginx/html/var/generation/Magento/Catalog/Block/Product/View/Interceptor.php(455): Magento\Catalog\Block\Product\View\Interceptor->___callPlugins('getImage', Array, Array) #10 /usr/share/nginx/html/vendor/magento/module-catalog/view/frontend/templates/product/view/opengraph/general.phtml(14): Magento\Catalog\Block\Product\View\Interceptor->getImage(Object(Magento\Catalog\Model\Product\Interceptor), 'product_base_im...') #11 /usr/share/nginx/html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/usr/share/ngin...') #12 /usr/share/nginx/html/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Product\View\Interceptor), '/usr/share/ngin...', Array) #13 /usr/share/nginx/html/var/generation/Magento/Catalog/Block/Product/View/Interceptor.php(544): Magento\Framework\View\Element\Template->fetchView('/usr/share/ngin...') #14 /usr/share/nginx/html/vendor/magento/framework/View/Element/Template.php(279): Magento\Catalog\Block\Product\View\Interceptor->fetchView('/usr/share/ngin...') #15 /usr/share/nginx/html/vendor/magento/framework/View/Element/AbstractBlock.php(657): Magento\Framework\View\Element\Template->_toHtml() #16 /usr/share/nginx/html/var/generation/Magento/Catalog/Block/Product/View/Interceptor.php(869): Magento\Framework\View\Element\AbstractBlock->toHtml() #17 /usr/share/nginx/html/vendor/magento/framework/View/Layout.php(542): Magento\Catalog\Block\Product\View\Interceptor->toHtml() #18 /usr/share/nginx/html/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('opengraph.gener...') #19 /usr/share/nginx/html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('opengraph.gener...') #20 /usr/share/nginx/html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('opengraph.gener...') #21 /usr/share/nginx/html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('opengraph.gener...', true) #22 /usr/share/nginx/html/vendor/magento/framework/View/Element/AbstractBlock.php(501): Magento\Framework\View\Layout\Interceptor->renderElement('opengraph.gener...', true) #23 /usr/share/nginx/html/vendor/magento/module-theme/view/frontend/templates/html/container.phtml(10): Magento\Framework\View\Element\AbstractBlock->getChildHtml() #24 /usr/share/nginx/html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/usr/share/ngin...') #25 /usr/share/nginx/html/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Framework\View\Element\Template), '/usr/share/ngin...', Array) #26 /usr/share/nginx/html/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/usr/share/ngin...') #27 /usr/share/nginx/html/vendor/magento/framework/View/Element/AbstractBlock.php(657): Magento\Framework\View\Element\Template->_toHtml() #28 /usr/share/nginx/html/vendor/magento/framework/View/Result/Page.php(234): Magento\Framework\View\Element\AbstractBlock->toHtml() #29 /usr/share/nginx/html/vendor/magento/framework/View/Result/Layout.php(162): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor)) #30 [internal function]: Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #31 /usr/share/nginx/html/vendor/magento/framework/Interception/Interceptor.php(74): call_user_func_array(Array, Array) #32 /usr/share/nginx/html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array) #33 /usr/share/nginx/html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-varnish-...') #34 /usr/share/nginx/html/vendor/magento/module-page-cache/Model/Controller/Result/VarnishPlugin.php(74): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor)) #35 [internal function]: Magento\PageCache\Model\Controller\Result\VarnishPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor)) #36 /usr/share/nginx/html/vendor/magento/framework/Interception/Chain/Chain.php(68): call_user_func_array(Array, Array) #37 /usr/share/nginx/html/vendor/magento/framework/Interception/Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-builtin-...') #38 /usr/share/nginx/html/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(67): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor)) #39 [internal function]: Magento\PageCache\Model\Controller\Result\BuiltinPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor)) #40 /usr/share/nginx/html/vendor/magento/framework/Interception/Interceptor.php(141): call_user_func_array(Array, Array) #41 /usr/share/nginx/html/var/generation/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array) #42 /usr/share/nginx/html/vendor/magento/framework/App/Http.php(119): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #43 /usr/share/nginx/html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch() #44 /usr/share/nginx/html/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) #45 {main}
Please help me to resolve the issue
Thanks