I just look up at rails sources and find folder named "dispatches". There is four file in it. I want to know purpose of this files. I know 开发者_如何学PythonI use this files on my production server, but I never used to think of their purpose. I know there is something about attaching Rails app to Apache server. On my production server rails appname
command add this files to public
folder automatically. Can I set up this behavior on my development machine?
The rails dispatcher is the entry point for a rails application and is used to bootstrap the environment.
They have a long history and in a lot of ways they are almost obsolete. In days gone by rails apps used to be powered using cgi or fastcgi, which was a way for the webserver to communicate with a rails process. The boot process would be initiated by dispatch.fcgi
or dispatch.cgi
. Nowadays people are more likely to use apache/nginx+passenger
or apache/nginx+mongrel/thin
. (Does anyone still use lighttpd?)
I'm a little fuzzy on how dispatch.rb
is used, but I think it's used by upstream rails servers such as mongrel/thin to bootstrap the rails process. However, now that rails is rack compatible I'm not entirely sure if that has changed.
You don't need to pay the dispatch.*
files any attention.
I hope this helps.
精彩评论