Today, I went to cyberspace to deploy my website for my friends. The server is a Windows2003 server. I did not expect to configure ror on Windows2003 as a nightmare, because I saw a lot of IIS and ror documents on the Internet. If you don't know, it's a nightmare. I was too busy till five o'clock P.M., but I still didn't configure it. I came back at night and thought about it. Something is wrong. It may be okay to change my mind.
The general idea is to install an Apache listener to port 8080, and then use Apache to switch to mongrel. Let's talk about the specific steps.
- first, download Ruby for Windows from the Internet. install it. Remember to install gem.
- install rails, mongrel, and mongrel_servicegem install rails
gem install win32-service
gem install mongrel
gem install mongrel_service
- prepare the ROR Program and I will have the OK Yamada Program
- Add the ROR program as a Windows Service
mongrel_rails service: Install-N MyApp-C: \ MyApp-P 4000-e production
you can also use mongrel_rails service: Remove-N MyApp to delete it.
now you can register as a service to manage your website in the control panel, administrative tools, and services. If it is set to auto start, it will be OK.
- after installing Apache, select the option that uses port 8080 to prevent conflicts with IIS. However, modify the httpd. conf file and cancel the comments of the three lines.
loadmodule proxy_module modules/mod_proxy.so loadmodule proxy_connect_module modules/mod_proxy_connect.so loadmodule proxy_http_module modules/mod_proxy_http.so
- in httpd. add the proxy pass setting in Conf.
proxypass/MyApp http: // 127.0.0.1: 4000/
proxypassreverse/MyApp http: // 127.0.0.1: 4000/
In this way, you can use http: // 127.0.0.1: 8080/MyApp for access. However, there is a problem, that is, your images and CSS cannot be displayed due to path issues. The solution is shown in javaeye.Code, Or add several lines of code at the end of httpd. conf. Of course, the proxy above should be deleted.
Proxyrequests off
<Proxy balancer: // mycluster>
Balancermember http: // localhost: 4000
Balancermember http: // localhost: 4001
</Proxy>
<Virtualhost *: 8080>
Servername www.cpu123.com
DocumentRoot D:/sdroad/Public
Proxypass/images!
Proxypass/stylesheets!
Proxypass/javascripts!
Proxypass/balancer: // mycluster/
Proxypassreverse/balancer: // mycluster/
Proxypreservehost on
</Virtualhost>
Okay, it's all done. You have time to configure it in the city. I find myself stubborn sometimes, and I can't stand what I want to accomplish without making it. If you don't get it out, you have to go to bed.