diff --git a/app/code/Magento/PageCache/etc/varnish3.vcl b/app/code/Magento/PageCache/etc/varnish3.vcl
index feb4d7c14df56a9ffce64d58c5b259c359e609b1..555661f81b78aed87b4fbd79756c555eadc8b2f8 100644
--- a/app/code/Magento/PageCache/etc/varnish3.vcl
+++ b/app/code/Magento/PageCache/etc/varnish3.vcl
@@ -6,6 +6,7 @@ import std;
 backend default {
     .host = "/* {{ host }} */";
     .port = "/* {{ port }} */";
+    .first_byte_timeout = 600s;
 }
 
 acl purge {
diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl
index dafeefbe5b5b7209626d23a97d1fbe88587e7450..559730af2d814b38b911a4f150bd8e04a7cbbc45 100644
--- a/app/code/Magento/PageCache/etc/varnish4.vcl
+++ b/app/code/Magento/PageCache/etc/varnish4.vcl
@@ -7,6 +7,7 @@ import std;
 backend default {
     .host = "/* {{ host }} */";
     .port = "/* {{ port }} */";
+    .first_byte_timeout = 600s;
 }
 
 acl purge {
diff --git a/nginx.conf.sample b/nginx.conf.sample
index 95f03f4dd2145f6f5521f1cb5eb770645e0c9f40..bb872a609e6446aea46b0a96427e880e1e2b4714 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -38,6 +38,12 @@ location ~* ^/setup($|/) {
     root $MAGE_ROOT;
     location ~ ^/setup/index.php {
         fastcgi_pass   fastcgi_backend;
+
+        fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
+        fastcgi_param  PHP_VALUE "memory_limit=768M \n max_execution_time=600";
+        fastcgi_read_timeout 600s;
+        fastcgi_connect_timeout 600s;
+
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include        fastcgi_params;