作者godfat (godfat 真常)
看板Ruby
標題Re: [問題] Lighttpd的設定方式
時間Tue Oct 13 20:49:32 2009
: → ryudo:樓上的大大可以教一下如果是nginx怎樣達成本文的目的呢?3Q 10/13 19
我就不測試了,從這邊 copy 過來的:
http://github.com/godfat/source-tools/
blob/master/lib/source-tools/templates/tconfig/nginx.conf.erb
假設你的 php 目錄底下有 rails app:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include conf/fastcgi_params;
}
# 以下這段要放在 php 之前,因為要先 match.
location ~ ^/your_rails_prefix/ {
# ...
}
我沒用過 rails fast-cgi, 你自己查查看 rails 怎麼設。
總之 fast-cgi 就參考 php 那樣設。其他的請參考 nginx wiki:
http://wiki.nginx.org/NginxConfiguration
不過我會建議你用 passenger, 或最近新的 unicorn, 或是 thin cluster.
passenger 是管理方便,thin cluster 是效能比較好。
passenger 很單純,就在 location 裡面加個:
passenger_enabled on;
rails_env production;
root /some/where/public;
unicorn 參考 github:
http://github.com/blog/517-unicorn
不過我自己是還沒試過。
--
生死去来、棚頭傀儡、一線断時、落落磊磊
《花鏡》-世阿弥
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.135.28.18
→ ryudo:thin可靠嗎?我沒啥聽說有production的站在用 10/15 18:29
→ ryudo:unicorn還是第一次聽到 10/15 18:30
→ ryudo:passenger for nginx有比apache版好嗎? 10/15 18:30
推 deduce:heroku就是用Thin,如果底下每個都算production的站台 10/15 23:00
→ deduce:大概就有至少兩萬多個Rails網站用Thin了 :D 10/15 23:00
→ ryudo:heroku用的是他們自己mod過的吧!? 10/19 16:29