From: Eric Hodel Date: 2006-12-06T04:59:03+09:00 Subject: Re: Starting XMLRPC server on virtual host returns EADDRNOTAVAIL On Dec 5, 2006, at 03:50 , Rene Tschirley wrote: > I tried to start a Ruby XMLRPC server on a linux-based virtual host > (using OpenVZ). > > Here is the code: > > $server = { > "host" => "my.host.name", > "port" => 73726 > } > > XMLRPC::Server.new(port=$server['port'],host=$server['host']) > > While the code works on a non-virtual host, bind returns EADDRNOTAVAIL > when the server is started on the virtual host: > > [2006-12-05 11:35:24] INFO WEBrick 1.3.1 > [2006-12-05 11:35:24] INFO ruby 1.8.5 (2006-08-25) [i486-linux] > [2006-12-05 11:35:24] WARN TCPServer Error: Cannot assign requested > address - bind(2) > /usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Cannot assign > requested address - bind(2) (Errno::EADDRNOTAVAIL) > > I tried to define the host by giving the numeric address. I checked > that > the host can resolve the hostname. The server can ping the server > address. The above code is started as superuser. Linux kernel > version is > 2.6.16, OpenVZ patch is version 026test015. For a WEBrick virtual host you need to pass :DoNotListen => true in the configuration options for the vhost WEBrick::HTTPServer: httpd = WEBrick::HTTPServer.new :DocumentRoot => nil vhost = WEBrick::HTTPServer.new :DoNotListen => true, :ServerName => 'vhost.example.com', :DocumentRoot => nil httpd.virtual_host vhost I'm not sure how to do this with XMLRPC::Server, though. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net I LIT YOUR GEM ON FIRE!