2013-01-13 143 views
0

我正在读一本关于“Ruby on Rails”的书,现在我必须使用Apache和Passenger部署我的应用程序。一切似乎正确安装,但是当我终于添加以下代码在Apache的配置文件:Ruby on rails - Apache配置文件错误

<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> 

,并尝试重新启动Apache:

$ sudo apachectl restart

我收到以下错误:

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.

线路245是指在下面的行:

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

任何想法我做错了什么?

回答

1

空间并不在此行中允许的,只是把整个路径用双引号

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

您在目录路径中使用了空格来转义空格或创建没有空格的路径。 而不是将它添加到apache2.conf在/etc/apache2/site-available中创建一个文件(称为newsite或其他东西),并在该文件中写入相同的东西。然后运行以下commad:

sudo a2ensite newsite 

然后,重新启动服务器,并添加您的服务器名称到/ etc/hosts中