How to fix error in Magento 2 ( +nginx ): 504 gateway timeout?

Just change your nginx configuration with these lines ( apache + nginx ):

proxy_read_timeout 1800;

or with this line ( nginx + php-fpm ):

fastcgi_read_timeout 1800;