I have a website on Magento 2 and when I try to access the website, it's really slow and it can take up to 2 minutes to charge a page. When I try to access the admin, either it's really slow like on the website or I get the error

504 Gateway Time-out

I don't know how to fix it. It seems to be related with varnish but I didn't find anything on the net, I couldn't find the files they talked about. Thanks for your help

Edit: When I try to access my website, I immediately get the home page with every element on it, but it keeps loading for 30 seconds.

1 Answer 1


A few initial checks I would make.

  1. Check your PHP settings:

Set the PHP memory limit.


Our detailed recommendations are:

  • Compiling code or deploying static assets, 756M
  • Installing and updating Magento components from Magento Marketplace, 2G
  • Testing, ~3-4G

Check your PHP version is correct, Magento supports PHP 7.4.0.

See: https://devdocs.magento.com/guides/v2.4/install-gde/prereq/php-settings.html#check-php-settings

  1. Ensure you have enabled your store's cache:

Either via Admin > System > (Tools) Cache Management,

Magento 2 Admin Cache Management

or via CLI:

bin/magento cache:enable
  1. Set your Magento mode to production:

Production mode also has better performance because static view files are populated in the pub/static directory and because of code compilation.

bin/magento deploy:mode:set production
  • Thanks for your answer. Where can I check my php settings? My php version is 7.0. My cache is enabled. I only have the "Page cache" in the invalidated status.
    – Akame14
    Commented Aug 24, 2020 at 6:56
  • Magento supports PHP 7.4.0. You can install Magento 2.4.0 with 7.3, but it is not tested or recommended. It is intended for upgrading from Magento 2.3.x to Magento 2.4.0. devdocs.magento.com/guides/v2.4/install-gde/prereq/…
    – Joshua34
    Commented Aug 26, 2020 at 15:26
  • To increase your PHP memory limit: Log in to your Magento server. Locate your php.ini file using the following command: $ php --ini As a user with root privileges, use a text editor to open the php.ini specified by Loaded Configuration File. Locate memory_limit. Change it to a value of 2GB for normal use and debugging. Save your changes to php.ini and exit the text editor. Restart your web server. support.magento.com/hc/en-us/articles/…
    – Joshua34
    Commented Aug 26, 2020 at 15:26
  • memory_limit was at "-1". I put 2GB. I restarted my web server, but nothing changes. It is still really slow.
    – Akame14
    Commented Aug 27, 2020 at 12:25
  • Without being able to see your specific server it is hard to tell exactly what is causing the issue. I recommend you contact your web hosting provider to see if they can assist you with speeding up your web server, there may be a setting or two which can be tweaked.
    – Joshua34
    Commented Aug 27, 2020 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.