Im running Nginx on my PS server. It have three Wordpress websites. Im trying to start converting one website into a Rails application. First I will convert only the front page. The other sections run under subdomains as seperate servers in Nginx. My question is, how to install and setup ruby on rails in this server without harming the existing websites? The home page of one website will run through Rails and the others through Nginx.
-
1Of course you can do this. You should actually try _something_ before asking your question; we aren't here to do all of your work for you. – Michael Hampton Apr 29 '13 at 03:27
2 Answers
Usually all you need is to setup a virtualhost
-ish server in nginx, I've never launched RoR apps before, but its as easy as:
server {
server_name ror.example.com;
proxy_set_header Host $host;
proxy_pass http://ror.example.com:3001;
}
placing that server section into your nginx config would setup a virtualhost named ror.example.com which proxies requests to any http app.
Or, you can setup nginx to think of your app as a location
definition:
location /ror-app/ {
proxy_pass ...(same as above)
}
HTH,

- 1,730
- 10
- 15
I think you have already a virtualhost for serving your wordpress site; I think you need only to install passenger for nginx (the passenger installer will compile for you an nginx with ror support) and configure the server{} activating passenger in it.
E.g from passenger docs
http {
...
server {
listen 80;
server_name www.mycook.com;
root /webapps/mycook/public;
passenger_enabled on;
}
...
}
Here is passenger docs: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_install
If you want to test the app you can also use passenger-standalone on an alternative port:
gem install passenger
cd /var/www/myrorapp/
passenger start
and this will open an nginx webserver at port 3000. Docs for this one are here: http://www.modrails.com/documentation/Users%20guide%20Standalone.html
I'm considering you have installed Ruby on your system (system wide or RVM or rbenv)
Bye

- 111
- 1