Possum
Posts: 34
Joined: Thu Mar 22, 2012 2:32 pm
Contact: Website

Point Apache to USB Drive

Thu Dec 20, 2018 8:18 pm

Hi
I have Apache up and running in the default directory
var/www/html

I want to point Apache to a USB drive. For example
mnt/usb

So I can have my site files on a USB drive instead of the Micro SD on my PI

I tried editing the

000-default.conf and default-ssl.conf files to point to mnt/usb
But still got forbidden user.

How can I point Apache to my USB drive....?

Thank You..

fbe
Posts: 642
Joined: Thu Aug 17, 2017 9:08 pm

Re: Point Apache to USB Drive

Thu Dec 20, 2018 9:37 pm

You may change the DocumentRoot in /etc/apache2/sites-available/000-default.conf or .../default-ssl.conf but you should look into /etc/apache2/apache2.conf too. There is some commented out sample configuration to allow access to /srv/ .

You could easily mount your USB drive to /var/www/html instead or create a symbolic link /var/www/html that points to the mountpoint of your USB drive.

User avatar
DougieLawson
Posts: 39094
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Point Apache to USB Drive

Thu Dec 20, 2018 10:20 pm

fbe wrote:
Thu Dec 20, 2018 9:37 pm
You may change the DocumentRoot in /etc/apache2/sites-available/000-default.conf or .../default-ssl.conf but you should look into /etc/apache2/apache2.conf too. There is some commented out sample configuration to allow access to /srv/ .

You could easily mount your USB drive to /var/www/html instead or create a symbolic link /var/www/html that points to the mountpoint of your USB drive.
My Apache root is at /srv/www/html/... and that's an NFS drive (so all 18 Raspberries can share some HTML/CSS/JS code). It's relatively easy to go through files with awk/sed/vi to s/var/srv/g and change everything.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Possum
Posts: 34
Joined: Thu Mar 22, 2012 2:32 pm
Contact: Website

Re: Point Apache to USB Drive

Fri Dec 21, 2018 5:37 am

It was the
/etc/apache2/apache2.conf
That needed attention..

Thank You....

Code: Select all

#<Directory /var/www/>
<Directory /mnt/usb/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Return to “Networking and servers”