cancel
Showing results for 
Search instead for 
Did you mean: 

In production mode the site does not load

Highlighted

In production mode the site does not load

Hello,
I'm having problems with Magento 2.2.6
I deploy and when I go to the site it does not load
Here's how I deploy:

php bin/magento deploy:mode:show
Current application mode: production. (Note: Environment variables may override this value.)

 

rm -rf /var/www/html/magento2/var/view_preprocessed/*
rm -rf /var/www/html/magento2/var/page_cache/*
rm -rf /var/www/html/magento2/pub/static/*

 

php bin/magento cache:flush
php bin/magento cache:clean

 

php bin/magento setup:static-content:deploy -f pt_BR en_US

 

cd /var/www/html/magento2
chown www-data:www-data -R *
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chmod 777 ./generated

 

systemctl restart apache2
systemctl restart varnish
systemctl restart redis-server
systemctl restart mysql

 

Follows magento settings:
catalog/frontend/flat_catalog_category - 1
catalog/frontend/flat_catalog_product - 1
dev/template/minify_html - 1
dev/js/merge_files - 1
dev/js/enable_js_bundling - 1
dev/js/minify_files - 1
dev/css/merge_css_files - 1
dev/css/minify_files - 1
dev/grid/async_indexing - 1
dev/static/sign - 0

 

Access the site and error 500 in attachment (error.png)

I modify the /var/www/html/magento2/.htaccess file and add
SetEnv MAGE_MODE developer
The site returns to work correctly without any errors (site.png).
When I comment this line back does not work

 

I can not find where the error is.
I want to leave the site in production mode but ERROR 500 occurs

I would like your help if possible.

 

error.png

error.png

 

site.png

site.png

 

10 REPLIES 10
Highlighted

Re: In production mode the site does not load

Hello @guilhermetb

 

Please run below commands:

 

sudo chmod -R 0777 var/ pub/ generated/
rm -rf var/cache/* var/view_preprocessed/*

php bin/magento deploy:mode:set production -s
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f pt_BR en_US
php bin/magento cache:flush
sudo chmod -R 0777 var/ pub/ gnerated/
Manish Mittal
https://www.manishmittal.com/
Highlighted

Re: In production mode the site does not load

Hi

 @Manish Mittal

I executed all the commands and the same error

Highlighted

Re: In production mode the site does not load

Please check your logs and share if there any error there?

Manish Mittal
https://www.manishmittal.com/
Highlighted

Re: In production mode the site does not load

@Manish Mittal

 

/var/www/html/magento2/var/log/exception.log

[2018-11-25 05:30:17] main.CRITICAL: Can't create directory /var/www/html/magento2/generated/code/Magento/Framework/Notification/NotifierInterface/. Class Magento\Framework\Notification\NotifierInterface\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. {"exception":"[object] (RuntimeException(code: 0): Can't create directory /var/www/html/magento2/generated/code/Magento/Framework/Notification/NotifierInterface/. Class Magento\Framework\Notification\NotifierInterface\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. at /var/www/html/magento2/vendor/magento/framework/Code/Generator.php:135)"} []

Highlighted

Re: In production mode the site does not load

Hello @guilhermetb

 

Please run below command:

 

sudo chmod -R 0777 var/ pub/ generated/
Manish Mittal
https://www.manishmittal.com/
Highlighted

Re: In production mode the site does not load

I gave up this installation
I deleted VPS and created a new one from the beginning
I'm going to use Nginx and PHP-FPM instead of Apache and PHP7.0
Should I use php7.0 from the default repository or add a new repository and use 7.1?

Highlighted

Re: In production mode the site does not load

Hello @guilhermetb

 

You can follow the Magento 2 official document for Magento 2.2.x technology stack requirements:

 

https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html

Manish Mittal
https://www.manishmittal.com/
Highlighted

Re: In production mode the site does not load

Tank you @Manish Mittal

Highlighted

Re: In production mode the site does not load

I struggled with this for hours and then figured out my docker instance was out of space.

 

Deleted all var/log files and everything started working again.

 

A symptom was that everytime I would run start my docker swarm it would indeed start 2 or 3 of the services needed for Magento. The expected output if you start your docker swarm multiple times is that it should just tell you each of the services are "up to date" instead of starting any of them.

 

Hope this helps somebody.