title: NextCloud with nginx: subdomain config for NextCloud serves document root instead of folder
body: <p>I'm trying to set up nextcloud on nextcloud.mydomain.com while I have my regular website on mydomain.com. Here's my default.conf for nginx:</p>
  
  <pre><code>server {
    listen 80;
    listen [::]:80;
    server_name IP_HERE;
    root /var/www/html/;
    index index.php index.html index.htm index.nginx-debian.html;
  
    location / {
      try_files $uri $uri/ =404;
    }
  
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
  
    location = /50x.html {
      root /var/www/html;
    }
  
     location ~ \.php$ {
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      include snippets/fastcgi-php.conf;
    }
  
    location ~ /\.ht {
      deny all;
    }
  }
  </code></pre>
  
  <p>The nextcloud.conf file follows Step 4 of this tutorial: <a href="https://www.linuxbabe.com/ubuntu/install-nextcloud-11-ubuntu-16-04-nginx-config" rel="nofollow noreferrer">https://www.linuxbabe.com/ubuntu/install-nextcloud-11-ubuntu-16-04-nginx-config</a></p>
  
  <p>I don't know why, but when I access nextcloud.mydomain.com I just get the index.html in my /html webroot instead of the nextcloud setup wizard in the /nextcloud folder.</p>
  
  <p>Any ideas? Thank you very much in advance!</p>