Reputation: 5619
i've got some problems with my ruby on rails server.
It is running under localhost:3333 in my debian vm under a windows8 host.
I've installed apache2 and passengermodul for apache to get ruby. And then I've installed rails.
Now I need a subdomain wich calls the ruby on rails server.
for example admin.localhost:3333
Is something like that possible? And when how can I configurate it?
Upvotes: 0
Views: 1812
Reputation: 15515
You can use the lvh.me
domain. That domain has a DNS entry that will redirect to localhost. This also works for subdomains, so you can visit admin.lvh.me:3000
and it will redirect to localhost:3000
while still having the subdomain available in the Rails request.
The advantage is that you don't have to edit your localhost file.
Upvotes: 2
Reputation: 17834
Add custom hosts with subdomains to the hosts
file, follow these steps
In your terminal, open hosts
file
cd /etc
sudo nano hosts
Add the host as mentioned in the following lines to the hosts file, you can add as many as you want
127.0.0.1 admin.localhost
127.0.0.1 subdomain.localhost
Save the file, CTRL + X
then press Y
Done.
To run with a custom port, specify the port number while starting the server,
rails s -p 3333
Now you can run your application with, admin.localhost:3333
Hope this helps!
Upvotes: 2