作者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
1F:→ ryudo:thin可靠吗?我没啥听说有production的站在用 10/15 18:29
2F:→ ryudo:unicorn还是第一次听到 10/15 18:30
3F:→ ryudo:passenger for nginx有比apache版好吗? 10/15 18:30
4F:推 deduce:heroku就是用Thin,如果底下每个都算production的站台 10/15 23:00
5F:→ deduce:大概就有至少两万多个Rails网站用Thin了 :D 10/15 23:00
6F:→ ryudo:heroku用的是他们自己mod过的吧!? 10/19 16:29