Can't create or write into the data directory - with NGINX + Centos 7

nc15

#1

Hey guys,

I could really use your help here, I’ve combed through multiple threads in here and on google trying to figure out, what exactly my problem is. I’ve spent hours at least and I’ve come to a point where I’m just hitting a wall. The weird thing is, is that I’ve setup Nextcloud before at least 3 other times. So here’s the deal.

The details:
OS: Centos 7
Webserver: nginx
Nextcloud: 15 (latest)

So, I get to the point where I’m able to browse to the page to put in my username and password and point the data directory, which I like to change the location, it’s simply my preference. Now, the data is on an external hard drive, so I have a path called /var/nextcloud, and when I mount my external it mounts data, so the full path is /var/nextcloud/data.

Here’s the thing, permissions! So, before I did www-data across the data directory, but I don’t have www-data on CentOS. According to what I’ve read, on CentOS www-data = apache, an account I DO have. So, here are the things I’ve tried:

Permissions:
sudo chmod -R 750 /var/nextcloud/data
sudo chmod -R 744 /var/nextcloud/data
sudo chmod -R 700 /var/nextcloud/data

Owners:
sudo chown -R apache:apache /var/nextcloud/data
sudo chown -R nginx:nginx /var/nextcloud/data

Restarted nginx, I don’t know what else to do. I’ve tried all sorts of combinations, rebooting, checking my nginx.conf file so that the user is apache in there (which is at /etc/nginx/nginx.conf).

I thought that it might have been SELinux, but it turned out not to be that either. So, I tried remounting, that didn’t work either. Like I said, I tried rebooting, nothing.

I simply don’t understand why permissions is such a problem for me, it seems easy enough, but I’m just not going anywhere with it. What am I doing wrong? I’ve followed Nextcloud documentation, I went through two set of notes that I have from previous installs, it’s just not making sense to me.


#2

Prueba a cambiar los permisos ANTES de configurar el acceso al disco duro externo.
Try changing the permissions BEFORE configuring access to the external hard drive.


#4

But the permissions have to be on the external hard drive itself?


#5

The external drive or the final data sheet or directory must have the same owner as your nextcloud installation.
I have the same issue but I use freenas to store Nextcloud plugin. so, read some articles:

https://forums.freenas.org/index.php?threads/how-to-giving-plugins-write-permissions-to-your-data.27273/

I changed permission into my external directory, and then, I create a jail redirect. After this, I setup the external storage into next cloud.

Sorry my English. Im Spanish spoken.


#6

That isn’t the issue. The permissions somehow don’t seem to be the problem (in terms of rwx), I changed it to 777 and I still get the same error, I feel like the owner of the directory is what really is causing me an issue. Since I’ve never done this in CentOS and I don’t have the account www-data, it’s really throwing me for a loop here.

So, here’s the deal. This drive was used by my previous instance of nextcloud, which I believe was nextcloud 14, I don’t know if that could cause a problem, I just don’t feel like it is. I feel like this has to do with the owner, and it’s driving me crazy. It’s set to apache because that’s what I keep reading is the functional equivalent of www-data. Can anyone with a CentOS verify this for me. The documentation is extremely unclear how to handle NGINX + CentOS + permissions issues. It’s been days and I’ve done a ton of reading, a ton of troubleshooting, and I’m going over all the steps over and over and over again and it’s not working out. I can see the landing page and it simply does not allow me to proceed. I can’t write into the data directory and documentation does not support what permission it needs to be other than what people keep insisting as apache.