如何设置Apache下一个西纳特拉应用与乘客? [英] How to setup a Sinatra app under Apache with Passenger?
本文介绍了如何设置Apache下一个西纳特拉应用与乘客?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们说我有最简单的单文件辛纳屈的应用程序。在他们的主页上的的hello world 会做。我想用的Phusion客运,又名mod_rails Apache下运行它。
- 什么目录结构,我需要?
- 什么我必须把对虚拟主机的conf文件?
- 我明白我需要一个rackup文件。什么在它为什么去?
解决方案
基本目录结构:
应用
| - config.ru#< - rackup文件
| - 你好 - app.rb#< - 您的应用程序
| - 公共/#< - 静态公共文件(乘客需要这个)
` - TMP /
` - restart.txt#< - 触摸这个文件重新启动应用程序
虚拟主机文件:
<虚拟主机*:80>
服务器名app.example.com
的DocumentRoot /路径/要/应用/公
<目录/路径/要/应用/公共>
为了允许,拒绝
所有允许
< /目录>
< /虚拟主机>
config.ru
#编码:UTF-8
需要'./hello-app
运行西纳特拉::应用
HELLO-app.rb(示例应用程序):
#!的/ usr / bin中/ env的红宝石
#编码:UTF-8
需要'RubyGems的'#红宝石1.8
要求辛纳特拉得到'/ HI做
你好,世界!
结束
restart.txt
是空的。
轻度有用的链接:
Let's say I have the simplest single-file Sinatra app. The hello world on their homepage will do. I want to run it under Apache with Phusion Passenger, AKA mod_rails.
- What directory structure do I need?
- What do I have to put on the vhost conf file?
- I understand I need a rackup file. What goes in it and why?
解决方案
Basic directory structure:
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
Virtual host file:
<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 (sample application):
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rubygems' # for ruby 1.8
require 'sinatra'
get '/hi' do
"Hello World!"
end
restart.txt
is empty.
Mildly useful links:
这篇关于如何设置Apache下一个西纳特拉应用与乘客?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文