好吧,我想知道在Ubuntu上是否可以在Lighty上运行rails和PHP.我想在一个服务器/域上运行我的PHP项目和Rails项目.
我对Linux的经验很少,所以请原谅我的天真.
如果这是一种方式,请让我知道:)
最佳答案
运行它们真的很简单.我一直这样做(ROR运行Redmine,其余的运行PHP).
你有两个真正的ROR选项.要么从FastCGI(我做什么)提供它,要么使用独立服务器(如Mongrel等)运行它并代理它.两者都有优势. FastCGI的优势在于它是独立的(无需运行辅助服务器).独立的优点是它更容易配置.
如果您有具体问题,我可以指导,但互联网上有关于如何执行此操作的指南.
我的lighttpd.conf:
$HTTP["host"] =~ "my.ror.site" {
server.error-handler-404="/dispatch.fcgi"
fastcgi.server = (".fcgi" => ("ror_1" => (
"min-procs"=>8,"max-procs" => 8,"socket" => "/tmp/myrorlock.fastcgi","bin-path"=> "/path/to/ror/site/public/dispatch.fcgi","kill-signal" => 9,"bin-environment" => ( "RAILS_ENV" => "production" )
)))
}
fastcgi.server = ( ".PHP" =>
(
(
"socket" => "/tmp/PHP-fastcgi.socket","bin-path" => "/usr/bin/php-cgi -c /etc/PHP.ini","min-procs" => 1,"disable-time" => 1,"max-procs" => 1,"idle-timeout" => 20,"broken-scriptfilename" => "enable","bin-copy-environment"=> (
"PATH","SHELL","USER"
),"bin-environment" => (
"PHP_FCGI_CHILDREN" => "40","PHP_FCGI_MAX_REQUEST" => "50000"
)
)
)
)
就是这样.注意kill-signal选项.这很重要,否则你每次重启服务器时都会遇到僵尸进程……