NextCloud not loading on Nginx

Hey guys,

I have setup NextCloud with Nginx on a Ubuntu 16.04 VM. I followed the install setup on the first screen and after that, NextCloud seems to be loading forever. It keeps showing me the loading screen and nothing seems to load.

I have setup the server with Nginx as follows:

server {
	listen 80;
	listen [::]:80;
	server_name drive.example.com;
	
	return 301 https://drive.example.com;
}

server {
	listen 443 ssl;
	server_name drive.example.com;
	
	ssl_certificate /etc/letsencrypt/live/drive.example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/drive.example.com/privkey.pem;
	
	root /home/web/drive;
	index index.php index.html index.htm;
	
	location / {
		try_files $uri $uri/ /index.php$is_args$args;
	}
	
	location ~ \.php$ {
		try_files $uri =404;
		fastcgi_pass unix:/run/php/php7.0-fpm.sock;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_buffering off;
		include fastcgi_params;
	}
}

The settings -> basic settings screen gives me the following errors:

- PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.
- Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.
- Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken.
- Your data directory and files are probably accessible from the Internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.

Moreover, when I go to the website, I get the following error on my browser console:

- PROPFIND https://drive.example.com/remote.php/webdav/ 405 (Method Not Allowed) on core.js?v=3b9f6278-0:5729
- Uncaught (in promise) TypeError: Cannot read property 'getElementsByTagNameNS' of null
    at Client._getSabreException (client.js?v=3b9f6278-0:421)
    at client.js?v=3b9f6278-0:485

The nextcloud.log file just shows me a bunch of JSON mentioning where the requrest is coming from, so nothing there. Nevertheless, here it is: https://pastebin.com/KAMdWMzR

Nextcloud version : 13.0.1
Operating system and version : Ubuntu 16.04
Apache or nginx version : Nginx 1.10.3
PHP version : PHP 7.0.28

Is this the first time you’ve seen this error? : First time I’m setting up NextCloud, so yes.

Nginx logs:

2018/05/08 13:14:50 [error] 4479#4479: *6391 directory index of "/home/web/drive/core/doc/user/_static/" is forbidden, client: 14.139.180.133, server: drive.example.com, request: "GET /core/doc/user/_static/ HTTP/1.1", host: "drive.example.com", referrer: "https://drive.example.com/core/doc/user/index.html"

Moreover, I would like to setup NextCloud with DigitalOcean Spaces (Ceph based), using the Amazon S3 compatible APIs. So please do guide me through that as well.

Regards,
Rakshith Ravi

I’d recommend to use the nginx configuration from the documentation:
https://docs.nextcloud.com/server/13/admin_manual/installation/nginx.html#

Sorry, can’t help with that.