NS records and permission related problem with NextCloud

for start you can change max_children for your php-fpm.
what happens if you remove/rename .htaccess ?

Hello,

Thank you for your support parzival

I increased the max from 8 to 20 for all the websites. Now I am getting max_children error for NextCloud Website only. Should I increase max_children even more?

[18-Sep-2020 20:06:32] WARNING: [pool NEXTCLOUD.WEBSITE] server reached max_children setting (20), consider raising it

I also increased the MaxRequestWorkers located at /etc/apache2/mods-enabled/mpm_event.conf from 150 to 250 after getting this error

[mpm_event:error] [pid 758:tid 139953702136896] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[mpm_event:error] [pid 758:tid 139953702136896] AH10159: server is within MinSpareThreads of MaxRequestWorkers, consider raising the MaxRequestWorkers setting

I have multiple users with different permissions, .htaccess is controlling users permissions. I am afraid deleting the .htaccess will severely affect the site.

I appreciate the support.

Regards,
Nasser

For sure, you can play with those settings, but from my personal experience, blindly increasing default settings might, in some cases, result in unstable system. First thing to do is to try and get rid off the errors and then when you finally find out whats wrong, try to optimise your VPS.
Are you still getting .htaccess not being readable? When I said to remove .htaccess I ment to rename it to .htaccess.bak for testing. Just to make sure if its the htaccess thats making funny things. And that did happened before.
I know that changing things on live server is never good idea but its not always possible to have spare VPS to play with before going into production.

1 Like

That’s correct. I will not increase max_children any more because I not sure how to calculate the optimal value for my VPS.

I have renamed the file to .htaccess.bak, then I restarted the server and added users with different permissions. I didn’t had any problems.

However, I am still getting the error on the /var/log/apache2/domains/DOMAIN.error.log

[Tue Sep 22 09:21:16.445677 2020] [core:crit] [pid 439584:tid 140519130408704] (13)Permission denied: [client MY.IP.ADDRESSE:0] AH00529: /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/’ is executable
[Tue Sep 22 10:38:41.903099 2020] [core:crit] [pid 439583:tid 140518965073664] (13)Permission denied: [client MY.IP.ADDRESSE:0] AH00529: /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/’ is executable
[Tue Sep 22 11:09:28.834464 2020] [core:crit] [pid 787:tid 140261829052160] (13)Permission denied: [client MY.IP.ADDRESSE:0] AH00529: /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/’ is executable

I am not sure how to fix this…

does your “data” folder has x bit set? just go to :
/home/USER/web/NEXTCLOUD.WEBSITE/public_html/
and do : ls -l in console , post results here.
I believe this is pure permission problem and nothing more.

This is the result

root@XXXXXXXXXX:~# cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/
root@XXXXXXXXXX:/home/USER/web/NEXTCLOUD.WEBSITE/public_html# ls -l
total 156
drwxr-xr-x 41 USER USER 4096 Sep 10 20:37 3rdparty
-rw-r–r-- 1 USER USER 16522 Sep 10 20:37 AUTHORS
-rw-r–r-- 1 USER USER 34520 Sep 10 20:37 COPYING
drwxr-xr-x 48 USER USER 4096 Sep 10 20:37 apps
drwxr-xr-x 2 USER USER 4096 Sep 10 20:38 config
-rw-r–r-- 1 USER USER 2004 Sep 13 09:36 config.php
-rw-r–r-- 1 USER USER 3967 Sep 10 20:37 console.php
drwxr-xr-x 23 USER USER 4096 Sep 10 20:37 core
-rw-r–r-- 1 USER USER 5140 Sep 10 20:37 cron.php
drwxrwx— 13 USER USER 4096 Sep 22 11:12 data
-rw-r–r-- 1 USER USER 156 Sep 10 20:37 index.html
-rw-r–r-- 1 USER USER 2960 Sep 10 20:37 index.php
drwxr-xr-x 6 USER USER 4096 Sep 10 20:37 lib
-rw-r–r-- 1 USER USER 283 Sep 10 20:37 occ
drwxr-xr-x 2 USER USER 4096 Sep 10 20:37 ocm-provider
drwxr-xr-x 2 USER USER 4096 Sep 10 20:37 ocs
drwxr-xr-x 2 USER USER 4096 Sep 10 20:37 ocs-provider
-rw-r–r-- 1 USER USER 3102 Sep 10 20:37 public.php
-rw-r–r-- 1 USER USER 5332 Sep 10 20:37 remote.php
drwxr-xr-x 4 USER USER 4096 Sep 10 20:37 resources
-rw-r–r-- 1 USER USER 26 Sep 10 20:37 robots.txt
-rw-r–r-- 1 USER USER 2379 Sep 10 20:37 status.php
drwxr-xr-x 3 USER USER 4096 Sep 10 20:37 themes
drwxr-xr-x 2 USER USER 4096 Sep 10 20:37 updater
-rw-r–r-- 1 USER USER 362 Sep 10 20:37 version.php

can you go to :
/home/USER/web/NEXTCLOUD.WEBSITE/public_html/
and do : chmod 755 data/

When I change the permission to 755 it reverte to 770.

I see, its default behaviour. I forgot to re-read the whole thread.
Ok, this is a bit different.
can you check if apache has acces to that folder:
su - www-data -s /bin/bash -c “cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/; ls -la”

Here is the output

cat you put whole line :
su - www-data -s /bin/bash -c “cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/; ls -la”
and not just : cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/; ls -la
the reason for this is to see if there is something wrong with default installation.
Also on my setup I have these permissions on folders starting at home folder:
home/ root.root
/home/user/ root.root permission 755
/home/user/web/ user.user permission 751
home/user/web/website.com/ user.user permission 751
/home/user/web/website.com/public_html/ user.www-data permission 751

Thank you for your support parzival. Here is the output

root@ADMIN:~# su - www-data -s /bin/bash -c ‘cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/; ls -la’ -bash: line 0: cd: /home/USER/web/NEXTCLOUD.WEBSITE/public_html/data/: Permission denied total 20
drwxr-xr-x 5 root root 4096 Sep 4 14:12 .
drwxr-xr-x 14 root root 4096 Jul 9 21:41 …
drwxr-xr-x 2 root root 4096 Jul 9 21:44 document_errors
drwxr-xr-x 2 root root 4096 Jul 9 21:43 html
drwxr-x— 5 root www-data 4096 Sep 4 14:12 nextcloud
root@ADMIN:~#

Ok. I think we are getting somewhere. It seems that www-data user aka apache cant reach your data directory.
can you do :
ls -l /home/USER/web/NEXTCLOUD.WEBSITE/

I really appreciate your support.

Here is the output.

root@ADMIN:~# ls -l /home/USER/web/NEXTCLOUD.WEBSITE/
total 28
drwxr-x–x 2 USER USER 4096 Sep 5 00:21 cgi-bin
drwxr-x–x 2 USER USER 4096 Sep 5 00:21 document_errors
dr-xr-x–x 2 USER USER 4096 Sep 6 23:41 logs
drwxr-x–x 3 USER USER 4096 Sep 5 00:25 private
drwxr-x–x 14 USER www-data 4096 Sep 22 11:09 public_html
drwxr-x–x 2 USER www-data 4096 Sep 5 00:21 public_shtml
dr-xr-x–x 2 USER USER 4096 Sep 5 00:21 stats
root@ADMIN:~#

and ls -l /home/USER/web/
is something like
drwxr-x–x USER USER NEXTCLOUD.WEBSITE
right?

Here is the output

root@ADMIN:~# ls -l /home/USER/web/
total 4
drwxr-x–x 9 USER USER 4096 Sep 5 00:21 NEXTCLOUD.WEBSITE
root@ADMIN:~#

I think you have two solutions for your problem, and I hope others will chime in:

  1. You can add www-data user to your USER group like:
    usermod -a -G USER www-data
  2. use setfacl like this:
    cd /home/USER/web/NEXTCLOUD.WEBSITE/public_html/
    setfacl --modify user:www-data:x data/ <— this is copy/paste line. user in this line is a statement so dont change user with your username. LIke I said just copy/paste this line.

Note: I hope some hestia admin will see this before we do something stupid. Personally I cant think of a single reason that we can mess things up, but it would be nice if someone made, perhaps, more elegant solution for this problem.

2 Likes

parzival thank you for your support. I used the second solution.

I will keep monitoring but should I rename .htaccess.bak to .htaccess or no need for that?

You should be able to use .htaccess, and It would be nice to report if everything works like it should.

Thank you parzival, I am no longer getting the error. I believe the problem has been fixed.

I have also increased the max_children again from 20 to 40. After the increase I have noticed improvement in performance and speed. Now the preview of the large PDF files is showing up instantly.

I really appreciate the support from you and everyone here.