比方说,我有最简单的单文件Sinatra应用程序。 在他们的主页上你好的世界会做。 我想用Phusion Passenger和AKA mod_rails在Apache下运行它。
我需要什么目录结构?
我必须把vhost conf文件放在什么地方?
基本目录结构:
app |-- config.ru # <- rackup file |-- hello-app.rb # <- your application |-- public/ # <- static public files (passenger needs this) `-- tmp/ `-- restart.txt # <- touch this file to restart app
虚拟主机文件:
<VirtualHost *:80> serverName app.example.com DocumentRoot /path/to/app/public <Directory /path/to/app/public> Order allow,deny Allow from all </Directory> </VirtualHost>
config.ru
# encoding: UTF-8 require './hello-app' run Sinatra::Application
hello-app.rb(示例应用程序):
#!/usr/bin/env ruby # encoding: UTF-8 require 'rubygems' # for ruby 1.8 require 'sinatra' get '/hi' do "Hello World!" end
restart.txt是空的。
温和有用的链接:
Heroku机架文件
Phusion乘客文档
乘客机架应用的示例vhost文件:
<VirtualHost *:80> serverName server.local serverAlias *.server.local DocumentRoot /dir/public RackEnv development <Directory /dir/public> Order allow,deny Allow from all </Directory> </VirtualHost>
示例Config.ru:
require File.expand_path('../boot.rb',__FILE__) use Rack::Middleware run Rack::Cascade.new([array])