title: How to set index.html as root file in Nginx?
body: <p>How to set index.html for the domain name e.g. <a href="https://www.example.com/" rel="noreferrer">https://www.example.com/</a> - leads user to index.html in root directory. </p>
  
  <p>I've tried different things like: </p>
  
  <pre><code>server {
      # some configs
  
      location = / {
              index index.html;
              fastcgi_index index.html;
      }
  or 
      location / {
              index index.html;
              fastcgi_index index.html;
      }
  
  }
  </code></pre>
  
  <p>Nothing helped me. </p>
  
  <p>There are some other configs with location keyword, though I'd commented them either.</p>
  
  <p>Other "location" configs in the <code>server {</code> clause: </p>
  
  <pre><code>location ~ .*(css|htc|js|bmp|jp?g|gif|ico|cur|png|swf|htm?|html)$ {
          access_log off;
          root $www_root;
  }
  
  location ~ \.php$
  {
          include                         /etc/nginx/fastcgi_params;
          index                           index.html;
          fastcgi_index                   index.html;
          fastcgi_param SCRIPT_FILENAME   $www_root$fastcgi_script_name;
          fastcgi_param QUERY_STRING      $query_string;
          fastcgi_param PATH_INFO         $fastcgi_path_info;
          fastcgi_pass                    127.0.0.1:9000;
          # Директива определяет что ответы FastCGI-сервера с кодом больше или равные 400
          # перенаправлять на обработку nginx'у с помощью директивы error_page
          fastcgi_intercept_errors        on;
          break;
  }
  
  location ~ /\.ht {
      deny all;
  }
  </code></pre>
  
  <p>All them were commented and uncommented, but nothing helped.</p>
  
  <p>PS Editions were made in /etc/nginx/sites-enabled/domainname.com file.</p>