# apache document root on second hard drive problem.

## Spockmeat

I have apache running on an older box with a small hard drive, which has now run out of room. So I stuck in a second drive, and I want to move apache's document root to that drive. So I mount the drive /dev/hdb1 on /mnt/web, and move all my web stuff off into that. Now, I changed the document root to reflect the new location, but when I try to start apache I get this error:

Starting httpd: Syntax error on line 267 of /etc/httpd/conf/httpd.conf:

DocumentRoot must be a directory

                                                           [FAILED]

No matter what I do,  I can't get apache to start with the document root on the second drive. I've tried making soft links from /var/www to /mnt/web, same error, I've tried mounting /dev/hdb1 to /var/www and I get the same error. Anyone know what I could be doing wrong? Or even know how I could move the whole /var directory to the second hard drive?

----------

## texas1emt

I ran into the exact same problem a few months ago and couldn't correct it.

Eventually I had a directory of /mnt/maxtordrive/files (which was on the 2nd drive).  I made a symlink from /var/www/localhost/htdocs/alt --> /mnt/maxtordrive/files and put an .htaccess file in /mnt/maxtordrive/files.  Then I put a redirect in .htaccess in /var/www/localhost/htdocs/ so that when someone requests the root of my website, it shuffles them directly to the 2nd drive's files.

----------

## Spockmeat

mmm, I see. Seems like that would incur some extra overhead, though it wouldn't matter in my case. If I don't find anything else out I'll try that, thanks for the tip.

----------

## j-m

/mnt/web is NOT a directory. It is a mountpoint.  :Rolling Eyes: 

/mnt/web/something is a directory.  :Idea: 

----------

## texas1emt

 *j-m wrote:*   

> /mnt/web is NOT a directory. It is a mountpoint. 
> 
> /mnt/web/something is a directory. 

 

Good point.  I completely overlooked that.  :Confused: 

----------

## po0f

Why not add an /etc/fstab entry for hdb1?

----------

## j-m

 *po0f wrote:*   

> Why not add an /etc/fstab entry for hdb1?

 

Eh?  :Confused:   :Rolling Eyes:   :Question: 

----------

## nielchiano

 *j-m wrote:*   

> /mnt/web is NOT a directory. It is a mountpoint. 
> 
> /mnt/web/something is a directory. 

 

shouldn't it be possible to use a mountpoint as document-root?

----------

## j-m

Shouldn´t is be possible to use  /dev/hdb1 as DocumentRoot?  :Rolling Eyes: 

File a bug report if you want - http://issues.apache.org/bugzilla/

----------

## texas1emt

 *j-m wrote:*   

> Shouldn´t is be possible to use  /dev/hdb1 as DocumentRoot?  

 

You CAN'T use a mount point like /dev/hdb1 as a document root.  You'd need to mount it to something like /mnt/secondhd/ and then mkdir /mnt/secondhd/files/ and then tell apache to use /mnt/secondhd/files/ as its document root.  Throw an .htaccess file in there, or otherwise Apache will complain when someone tries to access it.

----------

## sf_alpha

check the permissions, can apache access /mnt ? or /mnt/hdb1

----------

## j-m

 *texas1emt wrote:*   

>  *j-m wrote:*   Shouldn´t is be possible to use  /dev/hdb1 as DocumentRoot?   
> 
> You CAN'T use a mount point like /dev/hdb1 as a document root.  You'd need to mount it to something like /mnt/secondhd/ and then mkdir /mnt/secondhd/files/ and then tell apache to use /mnt/secondhd/files/ as its document root.  Throw an .htaccess file in there, or otherwise Apache will complain when someone tries to access it.

 

OK, you should probably tell someone else, I have pointed out the fact that you can´t use mounpoints for DocumentRoot a few days ago...  :Confused: 

----------

## texas1emt

 *j-m wrote:*   

> OK, you should probably tell someone else, I have pointed out the fact that you can´t use mounpoints for DocumentRoot a few days ago... 

 

Oops, sorry!

300th Post! Woooo!

----------

## Spockmeat

Oh I do indeed have a directory beyond my mount point. I have /mnt/media as the mount point of /dev/hdb1 and I have a directory /mnt/media/www/html set as the DocumentRoot. Apache still complains about the DocumentRoot not being a directory though.

I just checked the apache bug reports, and someone has the exact same issue I have already reported now. Meh :-\

----------

## huby

mount

/dev/hda3 on / type ext3 (rw,noatime)

proc on /proc type proc (rw)

/dev/hda1 on /boot type ext2 (rw,noatime)

/dev/hdc1 on /home/httpd/html/hosting type ext2 (rw,noatime,quota,usrquota)

/dev/hdd1 on /home/httpd/html/free type ext3 (rw,noatime)

none on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)

 grep DocumentRoot *

apache2.conf:## was : DocumentRoot /var/www/localhost/htdocs

apache2.conf:DocumentRoot /home/httpd/html

 grep /home/httpd/html *

apache2.conf:DocumentRoot /home/httpd/html

commonapache2.conf:    Alias /icons/ /home/httpd/html/icons/

commonapache2.conf:<Directory /home/httpd/html>

I have mounted two hard disks to directories in DocumentRoot  to avoid loss of time with symlinks` existing problems

Working!

----------

