0

I am using Ubuntu 12.04 and I have a rails application, that I would like to start on boot. Also if I start the server from console like

cd <path of the application>
rails s -p 3000

I will have to keep the console open, else the application will end as soon as I end the terminal.

Second to access the application I will have to access localhost:3000. I would rather like to have access it with a proper name like localhost/myapp or just myapp in browser.

First, is it possible? How do I do that?

PS: I already have some PHP applications running on Apache. I would not like to mess with the default 80 / 8080 port.

4

3 に答える 3

3

Edit /etc/hosts to add

127.0.0.1 myapp

Also, start with rails s -p 80 if you don't want to specify the 3000 port in the browser. This can interfere with an Apache process already listening to the 80 port.

EDIT : To make it work with Apache :

Let the Rails app on the 3000 port and enable mod proxy for Apache, in order to ProxyPass requests incoming to the myapp host.

There is several examples here : httpd.apache.org/docs/2.0/mod/mod_proxy.html

于 2012-11-07T18:57:43.730 に答える
2

You can use pow for this. Its a zero-config Rack server for Mac OS X.

** Edit **

Prax is an alternative for Linux OS

于 2012-11-07T18:55:02.177 に答える
0

If you don’t want to edit your hosts file you can also make use of localtest.me. Simply access your website with any subdomain like example.localtest.me:3000 or www.localtest.me:3000.

于 2019-08-16T02:08:18.013 に答える