2012-03-18 77 views
1

我在linode上使用Ubuntu 10.04,並且安裝了apache2和Rails 3.2.2。我的應用程序工作正常上example.com:3000Phusion乘客 - 安裝後我究竟做了些什麼?

我按照說明在此處安裝的Phusion乘客:

http://www.modrails.com/install.html 

這裏:

http://wiki.brightbox.co.uk/docs:rvm 

但我不知道如何真正在生產模式下在example.com上運行我的應用程序。我輸入的命令是做什麼的?我做'軌道服務器'或'rails server -p 80'嗎?我使用的是什麼命令?

編輯1:

我的虛擬主機文件位於

<VirtualHost *:80> 
ServerAdmin [email protected] 
ServerName example.com 
ServerAlias www.example.com 
DocumentRoot /srv/www/example.com/public_html/ 
ErrorLog /srv/www/example.com/logs/error.log 
CustomLog /srv/www/example.com/logs/access.log combined 

<Directory /srv/www/example.com/public_html/> 
    AllowOverride all 
    Options -Multiviews 
</Directory> 
</VirtualHost> 

有一兩件事我不知道的是我是否應該有一個目錄

/srv/www/example.com/public_html/ 

/srv/www/example.com/public/ 

的的Linode安裝指南說明了第一種方法(http://library.linode.com/web-servers/apache/installation/ubuntu-10.04-lucid),但Passenger說明了第二種方法。只要一致,它是否重要?

我的乘客模塊位如下所示在/ etc/apache2的/ MODS的可用:

在passenger.conf

PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11 
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125/ruby 

在passenger.load

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/ext/apache2/mod_passenger.so  

編輯2:我現在已將乘客模塊位添加到apache配置文件,而不是乘客.conf和passenger.load文件。我設置以下這個工作:

配置/環境/ production.rb ... config.assets.compile =真 ...

回答

1

安裝過程(例如,passenger-install-apache2-module部分)在最後給出了你需要做什麼的說明。

的主旨是使虛擬主機,比如說,/etc/apache2/sites-available/myapp的應用程序,看起來是這樣的:

<VirtualHost *:80> 
    ServerName example.com 
    ServerAlias *.example.com 
    DocumentRoot /path/to/app/public 

    PassengerMinInstances 2 
    PassengerPoolIdleTime 600 
    PassengerUserSwitching on 
    PassengerDefaultUser someuser 

    RailsBaseURI/

    <Directory "/path/to/app/public"> 
    FileETag none 
    Options All 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
    </Directory> 
</VirtualHost> 

確保你把乘客模塊位在適當的位置按照說明進行操作。下面是我的樣子:

$ cat /etc/apache2/mods-available/passenger.* 
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11 
PassengerRuby /usr/local/bin/ruby 

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/mod_passenger.so 

然後你只需做平常apache的東西:

sudo a2ensite myapp 
sudo /etc/init.d/apache2 reload 

假設example.com點,這臺機器,你要善於去。

+0

好的謝謝,看來我已經完成了上述所有。我認爲它必須是虛擬主機步驟的問題,因爲/ public_html和/ public – Zakoff 2012-03-18 13:22:37

+0

之間的差異我更新了指向myapp /公用文件夾的路徑。但是,我在主頁上看到的所有默認文件都是與rails一起提供的,它的索引是/,然後是一個404.html 500.html的列表等。我如何做最後一步來確保它能夠拾取我的根頁面呢? – Zakoff 2012-03-18 13:41:58

+0

您是否刪除了'public/index.html'? – rfunduk 2012-03-18 16:35:23