diff --git a/core/includes/file.inc b/core/includes/file.inc
index 18c2820..eb6a1c0 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -573,6 +573,29 @@ function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS)
  * Creates a .htaccess file in each Drupal files directory if it is missing.
  */
 function file_ensure_htaccess() {
+
+  // Test the web server identity.
+  $server_software = \Drupal::request()->server->get('SERVER_SOFTWARE');
+
+  if (!isset($server_software)) {
+    // Skip this in Drush where SERVER_SOFTWARE is not set
+    // and .htaccess never used anyway.
+    $use_htaccess = FALSE;
+  }
+  elseif (preg_match("/Nginx/i", $server_software)) {
+    $use_htaccess = FALSE;
+  }
+  elseif (preg_match("/Apache/i", $server_software)) {
+    $use_htaccess = TRUE;
+  }
+  else {
+    $use_htaccess = FALSE;
+  }
+
+  if (!$use_htaccess) {
+    return;
+  }
+
   file_save_htaccess('public://', FALSE);
   $private_path = \Drupal::config('system.file')->get('path.private');
   if (!empty($private_path)) {
diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 8d13c03..6e188c6 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -67,18 +67,34 @@ function file_requirements($phase) {
 
   // Check the server's ability to indicate upload progress.
   if ($phase == 'runtime') {
+    $description = NULL;
     $implementation = file_progress_implementation();
     $server_software = \Drupal::request()->server->get('SERVER_SOFTWARE');
-    $apache = strpos($server_software, 'Apache') !== FALSE;
-    $fastcgi = strpos($server_software, 'mod_fastcgi') !== FALSE || strpos($server_software, 'mod_fcgi') !== FALSE;
-    $description = NULL;
-    if (!$apache) {
+
+    // Test the web server identity.
+    if (preg_match("/Nginx/i", $server_software)) {
+      $is_nginx = TRUE;
+      $is_apache = FALSE;
+      $fastcgi = FALSE;
+    }
+    elseif (preg_match("/Apache/i", $server_software)) {
+      $is_nginx = FALSE;
+      $is_apache = TRUE;
+      $fastcgi = strpos($server_software, 'mod_fastcgi') !== FALSE || strpos($server_software, 'mod_fcgi') !== FALSE;
+    }
+    else {
+      $is_nginx = FALSE;
+      $is_apache = FALSE;
+      $fastcgi = FALSE;
+    }
+
+    if (!$is_apache && !$is_nginx) {
       $value = t('Not enabled');
-      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php.');
+      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires an Apache server running PHP with mod_php or Nginx with PHP-FPM.');
     }
     elseif ($fastcgi) {
       $value = t('Not enabled');
-      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php and not as FastCGI.');
+      $description = t('Your server is not capable of displaying file upload progress. File upload progress requires PHP be run with mod_php or PHP-FPM and not as FastCGI.');
     }
     elseif (!$implementation && extension_loaded('apc')) {
       $value = t('Not enabled');
diff --git a/core/modules/system/src/Tests/File/DirectoryTest.php b/core/modules/system/src/Tests/File/DirectoryTest.php
index d17db20..193254a 100644
--- a/core/modules/system/src/Tests/File/DirectoryTest.php
+++ b/core/modules/system/src/Tests/File/DirectoryTest.php
@@ -92,6 +92,35 @@ function testFileCheckDirectoryHandling() {
     // Test that the directory has the correct permissions.
     $this->assertDirectoryPermissions($directory, 0777, 'file_chmod_directory setting is respected.');
 
+    // Test the web server identity.
+    $server_software = \Drupal::request()->server->get('SERVER_SOFTWARE');
+
+    if (!isset($server_software)) {
+      // Skip this in Drush where SERVER_SOFTWARE is not set
+      // and .htaccess never used anyway.
+      $use_htaccess = FALSE;
+    }
+    elseif (preg_match("/Nginx/i", $server_software)) {
+      $use_htaccess = FALSE;
+    }
+    elseif (preg_match("/Apache/i", $server_software)) {
+      $use_htaccess = TRUE;
+    }
+    else {
+      $use_htaccess = FALSE;
+    }
+
+    if ($use_htaccess) {
+      // Remove .htaccess file to then test that it gets re-created.
+      @drupal_unlink(file_default_scheme() . '://.htaccess');
+      $this->assertFalse(is_file(file_default_scheme() . '://.htaccess'), 'Successfully removed the .htaccess file in the files directory.', 'File');
+      file_ensure_htaccess();
+      $this->assertTrue(is_file(file_default_scheme() . '://.htaccess'), 'Successfully re-created the .htaccess file in the files directory.', 'File');
+      // Verify contents of .htaccess file.
+      $file = file_get_contents(file_default_scheme() . '://.htaccess');
+      $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", 'The .htaccess file contains the proper content.', 'File');
+    }
+
     // Remove .htaccess file to then test that it gets re-created.
     @drupal_unlink(file_default_scheme() . '://.htaccess');
     $this->assertFalse(is_file(file_default_scheme() . '://.htaccess'), 'Successfully removed the .htaccess file in the files directory.', 'File');
