Ubuntu: Change Apache2 root folder drive


I'm trying to change the directory of my default Apache site to a folder in another drive.

The problem arises with the fact the Ubuntu has named all my additional mounted drives as New Volume, New Volume1, New Volume2, etc.

The space in the drive name causes issues in the /etc/apache2/sites-available/default which looks like this.

<VirtualHost *:80>  ServerAdmin webmaster@localhost    DocumentRoot /media/omk/New Volume2/Server  <Directory />      Options FollowSymLinks      AllowOverride None  </Directory>  <Directory /media/omk/New Volume2/Server/>      Options Indexes FollowSymLinks MultiViews      AllowOverride None      Order allow,deny      allow from all  </Directory>    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/  <Directory "/usr/lib/cgi-bin">      AllowOverride None      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch      Order allow,deny      Allow from all  </Directory>    ErrorLog ${APACHE_LOG_DIR}/error.log    # Possible values include: debug, info, notice, warn, error, crit,  # alert, emerg.  LogLevel warn    CustomLog ${APACHE_LOG_DIR}/access.log combined  

On apache2 restart, I get the following error

Syntax error on line 4 of /etc/apache2/sites-enabled/000-default:  

DocumentRoot takes one argument, Root directory of the document tree Action 'configtest' failed. The Apache error log may have more information. ...fail!

This is caused due to the space in the path, which Apache assumes as 2 different arguments separated by a space.

I need to either make it look like a single argument retaining the path


Change the volume name (which again I'm not able to figure out how)

Any help appreciated! Thanks.


Enclose your DocumentRoot in quotes

DocumentRoot "/media/omk/New Volume2/Server"

Same goes for the directory directive.

<Directory "/media/omk/New Volume2/Server/">

To change the Volume name you can just remount the drive.

sudo umount /media/omk/New\ Volume2 note: a slash will work to escape the space

sudo mkdir /media/omk/volume2

sudo mount /dev/sdXX /media/omk/volume2 replace XX with the drive letter&number

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »