12) Configure Apache to use the USB Drive

<-- Previous    Next –>

This page explains how to point your Apache server to a USB drive on your Raspberry Pi assuming that you have mounted the USB drive to the directory /websites on the Raspberry Pi as described on a previous page.

Instead of the default location of /var/www you want the configured server to point to /websites/www.

The Apache document root was set by default to /var/www/html.  It was configured in the following file:

/etc/apache2/sites-available/000-default.conf

So type in:

sudo nano /etc/apache2/sites-available/000-default.conf

and change the following line to what you want, in my case to /websites/www/html:

DocumentRoot /var/www/html

and save it by pressing Ctrl+ X and Y and return key.

Also do a:

sudo nano /etc/apache2/apache2.conf

and find this

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

and change /var/www/ to your preferred directory which in my case is:

/websites/www/

and save it by pressing Ctrl+ X and Y and return key.

After you saved your changes, just restart the Apache webserver.

sudo service apache2 restart

To do a test, you will need to create a test file in the /websites/www/html/ directory and run it from a web browser.

<-- Previous    Next –>