“没有这样的文件或目录 - config.ru”与Passenger + Sinatra + Apache

时间:2013-03-21 00:14:51

标签: ruby apache sinatra passenger vhosts

我似乎无法确定问题所在,但我似乎无法将我的应用部署到子URI。我的直觉说它是在我的vhost配置和我的符号链接之间,但这是我第一次与vhosts和乘客广泛合作。

当我尝试点击http://example.com/app ...

时,我遇到乘客错误
No such file or directory - config.ru

显示应用程序根目录:

/home/username/public/example.com/public

就其他事情而言......网站的目录结构:

example.com/
    |-- public/
        |-- index.php
        |-- app/
            |-- config.ru         
            |-- app.rb      
            |-- public/           
            `-- tmp/              
                `-- restart.txt 

vets在/etc/apache2/sites-available/example.com:

# domain: example.com
# public: /home/username/public/example.com/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin email@example.com
  ServerName  www.example.com
  ServerAlias example.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/username/public/example.com/public
   <Directory /home/username/public/example.com/public>
      Allow from all
   </Directory>

  RackBaseURI /app
  <Directory /home/username/public/example.com/public/app>
      Options -MultiViews
  </Directory>

  # Log file locations
  LogLevel warn
  ErrorLog  /home/username/public/example.com/log/error.log
  CustomLog /home/username/public/example.com/log/access.log combined
</VirtualHost>
我做的符号链接:

ln -s /home/username/public/example.com/public/app/public /home/username/public/example.com/app

config.ru:

#!/usr/bin/env ruby
require 'sinatra'

require File.expand_path('app.rb',__FILE__)

run Sinatra::Application

和app.rb:

#!/usr/bin/env ruby
# encoding: UTF-8
require 'sinatra'

get '/' do
    "App!"
end

不确定这里会出现什么问题,但我在这个VPS上有多个站点,所以目录结构有点时髦,有这么多的公共文件夹。我可能会让自己感到困惑。

0 个答案:

没有答案