How to serve Rails application with Passenger/Apache without domain name

apache-2.2phusion-passenger

I am trying to serve a Rails application using Passenger and Apache on a Ubuntu server.

The Passenger installation instructions say I should add the following to my Apache configuration file – I assume this is /etc/apache2/httpd.conf.

<VirtualHost *:80>
   ServerName www.yourhost.com
   DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
   <Directory /somewhere/public>
      AllowOverride all              # <-- relax Apache security settings
      Options -MultiViews            # <-- MultiViews must be turned off
   </Directory>
</VirtualHost>

However, I do not yet have a domain pointing at my server, so I'm not sure what I should put for the ServerName parameter. I have tried the IP address, but when I do that, restarting Apache gives

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Sun Jan 17 12:49:26 2010] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Sun Jan 17 12:49:36 2010] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

and pointing the browser at the IP address gives a 500 Internal Server Error.

The closest I have got to something sensible is with

<VirtualHost efate:80>
   ServerName efate 
   DocumentRoot /root/jpf/public
   <Directory /root/jpf/public>
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

where "efate" is my server's host name. But now pointing my browser at the server's IP address just gives a page saying "It works!" – presumably this is a default page, but I'm not sure where this is being served from.

I might be wrong in thinking that the reason I have been unable to get this to work is related to not having a domain name. This is the first time I have used Apache directly – any help would be most gratefully received!

Best Answer

I find myself in this situation before doing a server migration.

On the server end I configure the server correctly, and then locally I use the 'ghost' rubygem to modify my hosts (well the OS X equivalent), so I can test all is correct before flipping over DNS