I've just rebuilt a Pi2 from Stretch to Buster (by replacing the SD card), and now I can't get Apache2 to work properly.
On the basic install it is OK, the index page in /var/www comes up as expected. However, I'm running all my web stuff from a locally mounted disc (/media/extdisc1)
I've made a copy of /etc/apache2/sites-available/000-default.conf and altered the DocumentRoot field to :
/media/extdisc1/webstuff
and restarted the apache2 service. Now I get :
Forbidden
You don't have permission to access this resource.
Apache/2.4.38 (Raspbian) Server at 192.168.1.118 Port 80
I've checked the file permissions, and the php file that I'm trying to read has :
-rw-r--r-- webuser www-data
I've also got an index.html file in the same directory, with the same permissions, and I can't read that either, so I don't think this is a PHP problem.
Looking up the file tree, /media is drwxr-xr-x root root
/media/extdisc1 is the same
/media/extdisc1/webstuff is drwxr-xr-x webuser www-data
so as far as I can see, the file permissions/ownerships are OK.
As the user pi (and webuser), I am able to access the files via the command line.
From what I've been able to dig up on various websites, that seems to cover all bases, but I'm still not able to move forward.
Adrian
Apache2 403 error on rebuilt Pi
Frequently Ffoiled
Re: Apache2 403 error on rebuilt Pi
I had a thought.
As root, I created a softlink called webstuff from /var/www/html to /media/extdisc1/webstuff and then altered the DocumentRoot to /var/www/html/webstuff and I can now load my php files.
The question now is why does it work with a softlink, but not with the actual path ?
Adrian
As root, I created a softlink called webstuff from /var/www/html to /media/extdisc1/webstuff and then altered the DocumentRoot to /var/www/html/webstuff and I can now load my php files.
The question now is why does it work with a softlink, but not with the actual path ?
Adrian
Frequently Ffoiled
Re: Apache2 403 error on rebuilt Pi
You changed the DocumentRoot to /media/extdisc1/webstuff. You also need to give Apache the permission for HTTP access to this filesystem path. E.g. the permission for HTTP-access to /var/www is given in /etc/apache2/apache2.conf
Re: Apache2 403 error on rebuilt Pi
Thanks. That looks like something that has changed since I originally installed Apache2.
If I understand correctly, then I'll need something like :
Code: Select all
<directory /media/extdisc1/webstuff>
Options indexes FollowSymLinks
AllowOveride None
Require all granted
</directory>
Adrian
Frequently Ffoiled
Re: Apache2 403 error on rebuilt Pi
I've tried that (and after sorting out the typos) it works.ffoiled wrote: ↑Sun Jun 14, 2020 7:36 pmThanks. That looks like something that has changed since I originally installed Apache2.
If I understand correctly, then I'll need something like :
adding to the apache2.conf file.Code: Select all
<directory /media/extdisc1/webstuff> Options indexes FollowSymLinks AllowOveride None Require all granted </directory>
Adrian
Thanks for the assistance.
Adrian
Frequently Ffoiled