gotqn
gotqn

Reputation: 43636

Ruby on rails - Apache config file error

I am reading a book about "Ruby on Rails" and now I have to deploy my application using Apache and Passenger. Everything seems to be installed properly but when I have finally add the following code in the Apache config file:

<VirtualHost *:80>
   ServerName depot.yourhost.com
   DocumentRoot /home/gotqn/Aptana Projects/depot/public/

   <Directory /home/gotqn/Aptana Projects/depot/public>
      AllowOverride all
      Options -MultiViews
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

and try to restart the Apache:

$ sudo apachectl restart

I get the following error:

Syntax error on line 245 of /etc/apache2/apache2.conf:

DocumentRoot takes one argument, Root directory of the document tree

Action 'restart' failed.

The Apache error log may have more information.

The line 245 refers to the following line:

DocumentRoot /home/gotqn/Aptana Projects/depot/public/

Any ideas what I have done wrong?

Upvotes: 1

Views: 388

Answers (2)

dimuch
dimuch

Reputation: 12818

Spaces are not allowed in this line, just put the whole path in double quotes

DocumentRoot "/home/gotqn/Aptana Projects/depot/public/"

Upvotes: 2

Rahul Tapali
Rahul Tapali

Reputation: 10137

You used spaces in directory path you need to escape the spaces or create path without spaces. Instead of adding it to apache2.conf create one file(called newsite or something) in /etc/apache2/site-available and write the same thing in that file. And then run following commad:

    sudo a2ensite newsite 

Then restart server and add your server name to /etc/hosts

Upvotes: 2

Related Questions