I have setup phusion passenger on my development server.
<VirtualHost *:80>
ServerName railscasts.local
DocumentRoot "/Users/rbates/code/railscasts/public"
RailsEnv development
RailsAllowModRewrite off
<directory "/Users/rbates/code/railscasts/public">
Order allow,deny
Allow from all
</directory>
</VirtualHost>
I would like to access my rails application from other machines on the network, but i would prefer not to have to configure my hosts file for each machine i want to access it from.
127.0.0.1 railscasts.local
From my understanding, i could setup a local DNS server which would solve the problem, but, again, i would prefer not to have to do that. I tried setting ServerName to the ip address of my development server, but this didn’t work, it just failed silently.
Is there anyway to accomplish this other than a DNS Server, or configuring every machine on the LAN? Should i be able to achieve it by specifying an ip address?
Thanks
You could either use IP based virtual hosting in Apache, assigning each app to its own IP address, or, use different ports.
I’m assuming you have more than one app in development because otherwise an even easier solution would be simply to make this vhost the default one.
Setting up IP and/or Port based vhosting is straightforward enough. You just need to Listen [1] to the relevant IPs / Ports and then use the ip.address:port in the VirtualHost container as per your example above.
[1] http://httpd.apache.org/docs/current/mod/mpm_common.html#listen