1

My Raspian Apache2 does not seem to like the www folder on a RAspberry-3B USB drive, which I can easily access from my Windows network.
It keeps giving me
You don't have permission to access / on this server. Apache/2.4.25 (Raspbian) Server at 192.168.200.99 Port 80
All works OK however if the /var/www folder is used. And even PHP works OK.
My (abbreviated) setup is as follows-
FSTAB:

UUID=1375-E205 /media/USBdrive32 vfat auto,sync,umask=000,gid=root,uid=root,rw 0 0 

I can easily access this from Windows+Samba.
The Apache conf file is as follows-

##### <Directory /var/www/>  
<Directory **/media/USBdrive32/www/**>
    Options Indexes FollowSymLinks
    AllowOverride None
        Require all granted
</Directory>

the usb has the following permissions: (sample)
drwxrwxrwx 6 root root 16384 Sep 1 14:00
I have tried changing this to u= (me) g=www-data, but the same results are obtained.
Ideally, once this working, I'd like to change the whole USB media drive, or at least the www folder on it, to umask=004 or perhaps even 007.
I can edit the www folder from my Windows Notepad++ But Apache will not allow me to use it as a LAMP webserver.
Any ideas on where my 403 forbidden problem is?

8
  • Why not change the uid & gid on your mount command to www-data as that's what Apache2 runs with.
    – Dougie
    Commented Mar 1, 2019 at 2:37
  • Been there, done that. i.e . User= (me) group=www-data. Ahh. I have not tried USER as www-data .... but the /var/html uses root and root. So why does it work OK?
    – aqk
    Commented Mar 1, 2019 at 2:38
  • Nope. UUID=1375-E205 /media/USBdrive32 vfat auto,sync,umask=000,gid=www-data,uid=www-data,rw 0 0 does not work either....
    – aqk
    Commented Mar 1, 2019 at 2:47
  • What shows up in /var/log/apache2/error.log when you get the 403?
    – Dougie
    Commented Mar 1, 2019 at 2:52
  • AHA! [Thu Feb 28 22:53:29.873091 2019] [mpm_prefork:notice] [pid 5711] AH00163: Apache/2.4.25 (Raspbian) configured -- resuming normal operations [Thu Feb 28 22:53:29.873281 2019] [core:notice] [pid 5711] AH00094: Command line: '/usr/sbin/apache2' [Thu Feb 28 22:54:14.692808 2019] [authz_core:error] [pid 5729] [client 192.168.200.63:50309] AH01630: client denied by server configuration: /var/www/html/ Somewhere it is still looking at /var/www... it must be something in an include in the .conf folder- I'll look at it...
    – aqk
    Commented Mar 1, 2019 at 4:00

1 Answer 1

1

The Apache webserver used to have almost all its parameters in the parent file: /etc/apache2/apache2.conf
Now it's a case of modifying its includes.
In this case, specifically the /etc/apache2/sites-available/000-default-conf file, which now contains the <VirtualHost *:80>
The last time I used this (six months ago!), it was in its parent apache2.conf

Its DocumentRoot parameter must be changed from the /var/www/html/ to the FAT32 USB media file as set up in the fstab.
E.G. DocumentRoot /media/USBdrive32/www

All is OK now. Apache2 can access the www folder, AND I can edit it with either Windows-10 or Linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.