Posts: 1
Joined: Thu Jan 31, 2019 2:51 am

Web Server on PI

Thu Jan 31, 2019 2:58 am


I need some help. I recently set up a web server on my Raspberry PI, with Apache2, and Joomla. All worked well in the default web directory, /var/www/html. As the SD card only has 32 gig on it, i decided to add a external 1TB drive to the PI, and move the web files to a directory on the external drive. Whenever I try to bring up the PHP file on the external drive, I get a forbidden error. What have I missed. I will be happy to provide any additional information needed to get this to work.

Thanks ahead of time for any assistance.

User avatar
Posts: 2835
Joined: Wed Aug 28, 2013 3:31 am

Re: Web Server on PI

Thu Jan 31, 2019 3:07 am

Normally webserver only allow access to files and folders under the html index folder.
That to stop access for outside looking at your whole file system.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Posts: 2450
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Web Server on PI

Thu Jan 31, 2019 3:32 am

What security rights do you have on the new folders? They need to be owned by www-data with a group of www-data

You may also need to alter your .htaccess file for redirects etc.

Also check Apache config to see if it has any restrictions in the virtual hosts files.
Need Pi spray - these things are breeding in my house...

User avatar
Posts: 13888
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Web Server on PI

Thu Jan 31, 2019 6:18 am

How is your external drive formatted? The best option would be to use an ext4 filesystem. After mounting, make sure the mount point has at least read access for the www-data user and group.

Did you change your Apache configuration to point to where the drive is mounted, or did you mount it on /var/www/html? I usually use the latter method.

User avatar
Posts: 754
Joined: Thu Nov 02, 2017 2:30 pm
Location: Unknown
Contact: Website

Re: Web Server on PI

Thu Jan 31, 2019 11:32 am

It might be best to boot raspbian from the HDD. (If you have a Pi 3B or later) It will save a lot of troubleshooting.
1 * Raspberry Pi Zero W, 1 * Raspberry Pi 2, 1 * Raspberry Pi 3 1 * Raspberry Pi 3B + :mrgreen:

Check Out My Raspberry Site (Run on a Raspberry Pi 3B :) ): Https://

Return to “Advanced users”