It's hard and painful to start every time, but it's all we have to do
We have to improve our work because rails requires a request to be processed every time it is handled by the requests, and it is quite scary to ask for the next requests only after the current request has been processed. I once did a website that could upload software, suppose a user uploads an ebook, because the Internet is not fast, it took him 5 minutes to complete the operation, that is, his request will occupy 5 minutes, the same means that the site in 5 minutes is inaccessible, this is terrible.
What is mongrel?
A fast web Server faster than Webrick
What is LIGHTTPD?
For forwarding request to a cluster of Mongrel
Use them to troubleshoot rails ' problems on request
Below we start to install the Windows version of the LIGHTTPD, download the address is: http://www.kevinworthington.com:8181/?p=116, but I write this article can not download at all times. The Windows version of LIGHTTPD is installed by default in C:/LIGHTTPD, and this installation location cannot be modified
Then install mongrel, use the command line: The gem install mongrel–include-dependencies command to install, and when installed, select the Windows version, run under the Rails app directory Mongrel_ Rails Start-p 4001, you can open Mongrel server, before I have published a piece called the "Mongrel---faster is Possible" article, note that in addition to the installation of Mongrel, but also to install the service
Just from Webrick to mongrel will feel a lot faster, using the-e production to open production environment
To install Mongrel as a Windows service:
Mongrel_rails service::install-n myapp_dev-c C:\Rails\MyApp-p 4001-e Production
You can set up to be automatic, installation becomes a service is necessary, because, you can not log on to the server every time, to run your server, even if you add to the boot, you also need to use the user login after the system can automatically start
If you want to remove this service use:
Mongrel_rails Service::remove-n Myapp_dev
Configure LIGHTTPD, configure Port:
Open c:\lighttpd\etc\lighttpd.conf
Uncomment server.port = 81 Before you can also use port:80
Open the module, other modules do not open, there will be problems
server.modules = ("mod_proxy",
"mod_rewrite",
"mod_accesslog",
"mod_alias" )
In addition to the bottom of this configuration file plus:
proxy.debug = 0
proxy.balance = "fair"
proxy.server = ( "/" =>
(
( "host" => "127.0.0.1", "port" => 4001 ),
( "host" => "127.0.0.1", "port" => 4002 )
)
)
The port here is the port of the Mongrel server, which starts the LIGHTTPD use command:
C:\lighttpd\sbin\lighttpd.exe-D-F c:\lighttpd\etc\lighttpd.conf
You can access it successfully through HTTP://LOCALHOST:81/