Redirect example.com to rails server running on localhost:3000 leaving apache sites intact?

StackOverflow https://stackoverflow.com/questions/15675252

Вопрос

I am working on a rails app which runs on localhost:3000. I want example.com to point to localhost:3000. I edited the /etc/hosts file but it doesn't take port number so the request goes to apache. I want apache sites to work as they are but redirect example.com to rails server.

Please suggest the best way to achieve this.

Это было полезно?

Решение

Can you just specify example.com:3000 when browsing to your site? If not, I'd suggest using Phusion Passenger so that Apache can continue to respond on port 80 while also running your app.

Другие советы

Use mod_proxy?

ProxyPass /your_rails_app http://your.server.address:3000
ProxyPassReverse /your_rails_app http://your.server.address:3000

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top