2013-06-05 42 views
1

我有一個Sinatra應用程序,我使用Thin運行在開發/階段,現在是時候進入生產了,我開始檢查如何在乘客的Apache中服務。無法爲我的sinatra應用程序提供乘客/ apache

我跟着主要

http://recipes.sinatrarb.com/p/deployment/apache_with_passenger http://www.rabblemedia.net/blog/installing-rvm-ruby-on-rails-and-passenger-on-centos-6/ http://sergiy.kyrylkov.name/2012/02/26/phusion-passenger-with-apache-on-rhel-6-centos-6-sl-6-with-selinux/

我的地方框運行Fedora 16,阿帕奇2.2,紅寶石1.9+

我安裝了乘客

gem install passenger 

,然後

passenger-install-apache2-module 

幾乎跟着指示,比如增加乘客模塊

#mod_rails passenger 
LoadModule passenger_module /home/orlybg/.gem/ruby/1.9.1/gems/passenger-4.0.5/libout/apache2/mod_passenger.so 
PassengerRoot /home/orlybg/.gem/ruby/1.9.1/gems/passenger-4.0.5 
PassengerDefaultRuby /usr/bin/ruby 

這是我的虛擬主機:

<VirtualHost *:80> 
DocumentRoot "/var/www/html/billomatic" 
ServerName billomatic 
RailsEnv development 

<Directory "/var/www/html/billomatic"> 
    Options Indexes MultiViews FollowSymLinks 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
</Directory> 

LogLevel debug 
ErrorLog "/var/log/httpd/billomatic-error_log" 
CustomLog "/var/log/httpd/billomatic-access_log" common 

而且我config.ru

require 'rubygems' 
require 'sinatra' 
set :environment, ENV['RACK_ENV'].to_sym 
disable :run, :reload 
require File.join(File.dirname(__FILE__), 'bill-o-matic.rb') 
run Sinatra::Application 

當我打

http://billomatic/ 

我得到的Fedora頁面的默認的Apache,在第一thevhost錯誤日誌抱怨

==> billomatic_error.log <== 
[Wed Jun 05 12:45:42 2013] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/billomatic/ 

但我只是給了billomatic目錄755個許可證,並沒有記錄顯示再有,在一般的Apache日誌我看到這個當我重新啓動:

==> error_log <== 
[Wed Jun 05 15:27:50 2013] [warn] module passenger_module is already loaded, skipping 
[Wed Jun 05 15:27:50 2013] [notice] Digest: generating secret for digest authentication ... 
[Wed Jun 05 15:27:50 2013] [notice] Digest: done 
[ 2013-06-05 15:27:50.6784 6952/7f2f3be64740 agents/Watchdog/Main.cpp:440 ]: Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nobody', 'default_python' => 'python', 'default_ruby' => '/usr/bin/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_instances_per_app' => '0', 'max_pool_size' => '6', 'passenger_root' => '/home/orlybg/.gem/ruby/1.9.1/gems/passenger-4.0.5', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_pid' => '6951', 'web_server_type' => 'apache', 'web_server_worker_gid' => '48', 'web_server_worker_uid' => '48' } 
[ 2013-06-05 15:27:50.6964 6955/7f8f0d25b740 agents/HelperAgent/Main.cpp:555 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.6951/generation-0/request 
[ 2013-06-05 15:27:50.7037 6952/7f2f3be64740 agents/Watchdog/Main.cpp:564 ]: All Phusion Passenger agents started! 
[ 2013-06-05 15:27:50.7071 6960/7f29a108e840 agents/LoggingAgent/Main.cpp:271 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.6951/generation-0/logging 
[Wed Jun 05 15:27:50 2013] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads. 
[Wed Jun 05 15:27:50 2013] [notice] mod_python: using mutex_directory /tmp 
[Wed Jun 05 15:27:50 2013] [notice] Apache/2.2.23 (Unix) DAV/2 Phusion_Passenger/4.0.5 PHP/5.4.11 mod_python/3.3.1 Python/2.7.3 mod_perl/2.0.5 Perl/v5.14.3 configured -- resuming normal operations 

當我運行

passenger-memory-stats 

我得到這個:

--------- Apache processes --------- 
PID PPID VMSize Private Name 
------------------------------------ 
7362 1  380.0 MB ?  /usr/sbin/httpd -k start 
7381 7362 380.1 MB ?  /usr/sbin/httpd -k start 
7382 7362 380.1 MB ?  /usr/sbin/httpd -k start 
7383 7362 380.0 MB ?  /usr/sbin/httpd -k start 
7384 7362 380.0 MB ?  /usr/sbin/httpd -k start 
7385 7362 380.1 MB ?  /usr/sbin/httpd -k start 
7386 7362 380.0 MB ?  /usr/sbin/httpd -k start 
7387 7362 380.0 MB ?  /usr/sbin/httpd -k start 
7388 7362 380.1 MB ?  /usr/sbin/httpd -k start 
### Processes: 9 
### Total private dirty RSS: 0.00 MB (?) 


-------- Nginx processes -------- 

### Processes: 0 
### Total private dirty RSS: 0.00 MB 


---- Passenger processes ----- 
PID VMSize Private Name 
------------------------------ 
7363 209.8 MB ?  PassengerWatchdog 
7366 491.1 MB ?  PassengerHelperAgent 
7371 145.5 MB ?  PassengerLoggingAgent 
### Processes: 3 
### Total private dirty RSS: 0.00 MB (?) 

*** WARNING: Please run this tool as root. Otherwise the private dirty RSS of processes cannot be determined. 

什麼奇怪的,當我執行

passenger-status 

是我得到:ERROR:客運的Phusion似乎沒有運行。

此外,當我嘗試使用sudo運行最後一個命令時,系統顯示找不到命令。

我缺少什麼/做錯了什麼線索?

在此先感謝。

更新:我還禁用了SELinux,並在我的sinatra項目目錄中添加了一個tmp/restart.txt。

回答

7

變化DocumentRoot "/var/www/html/billomatic"DocumentRoot "/var/www/html/billomatic/public"

<Directory "/var/www/html/billomatic"><Directory "/var/www/html/billomatic/public">

+0

太感謝你了,我完全放棄了這個前 – orlybg

相關問題