Running Webrick alongside IIS on port 80

Hi,
I am hosting a couple of asp.net sites on IIS on my server.

Now I need to host another site in ruby on the same machine. For this I
guess i will need to run the webrick server.

Can anyone tell me how to have both iis and webrick running on port 80,
otherwise people will need to add the port 3000 to the site name each
time they visit the ruby site.

It’s not possible to have both IIS and webrick listen on port 80. You
might want to look into configuring IIS to proxy requests to webrick
using something like this: http://www.isapirewrite.com/. That way your
users will be able to connect through IIS to webrick without having to
specifiy a port in the URL. If you google for “rails ISAPI_Rewrite” you
should be able to find the info you need.

On 12.01.2007 23:47, Prashant D. wrote:

Hi,
I am hosting a couple of asp.net sites on IIS on my server.

Now I need to host another site in ruby on the same machine. For this I
guess i will need to run the webrick server.

Can anyone tell me how to have both iis and webrick running on port 80,
otherwise people will need to add the port 3000 to the site name each
time they visit the ruby site.

Um, you cannot have to processes listen on the same port on one
interface. You either have to resort to using a different port with
WebRick (hopefully this is not a production server) or you make IIS
serve Ruby code. You can certainly do this with CGI. I do not know
whether there is better (faster) integration available for this web
server (FastCGI?). Another solution is to configure a redirect in IIS
that sends certain URL’s off to the WebRick server on another port.
Lots of options…

Kind regards

robert

Robert K. wrote:

On 12.01.2007 23:47, Prashant D. wrote:

Can anyone tell me how to have both iis and webrick running on port 80,
otherwise people will need to add the port 3000 to the site name each
time they visit the ruby site.

Um, you cannot have to processes listen on the same port on one
interface.

Sure you can. You can if you give the interface card 2 IP addresses
and have each process only listen to port 80 on one of the IPs.
I don’t know how to do this in IIS; but Apache’s docs describe
in their “Setting up multiple daemons” daemons section. I assume
webrick offers similar? Or are you considering this a different port?

You either have to resort to using a different port with
WebRick (hopefully this is not a production server) or you make IIS
serve Ruby code. You can certainly do this with CGI. I do not know
whether there is better (faster) integration available for this web
server (FastCGI?). Another solution is to configure a redirect in IIS
that sends certain URL’s off to the WebRick server on another port. Lots
of options…

I’d say his easiest alternative is to run Apache on port 80; and
have it proxy some requests to some ruby server (hopefully better
than webrick - maybe mongrel) and proxy other requests to IIS running
on a different port. And then firewall off the IIS and webrick ports
of course for security reasons.

Prashant D. wrote:

Hi,
I am hosting a couple of asp.net sites on IIS on my server.

Now I need to host another site in ruby on the same machine. For this I
guess i will need to run the webrick server.

No. There are several options for hosting Ruby code. Plain CGI or
FastCGI + [apache|lighhtp], or Mongrel, perhaps.

Or IIS. It can server Ruby up as CGI, I believe.

There’s also ActiveScriptRuby:

http://www.geocities.co.jp/SiliconValley-PaloAlto/9251/ruby/index.html

which could maybe be used as an ASP language.


James B.

http://www.ruby-doc.org - Ruby Help & Documentation
http://beginningruby.com - Beginning Ruby: The Online Book
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys

On 13.01.2007 16:17, Ron M wrote:

Robert K. wrote:

On 12.01.2007 23:47, Prashant D. wrote:

Can anyone tell me how to have both iis and webrick running on port 80,
otherwise people will need to add the port 3000 to the site name each
time they visit the ruby site.
Um, you cannot have to processes listen on the same port on one
interface.

Sure you can. You can if you give the interface card 2 IP addresses
and have each process only listen to port 80 on one of the IPs.

You actually can have two IP addresses on one NIC? Are you sure
about that? How would you configure that for example on Linux?

I don’t know how to do this in IIS; but Apache’s docs describe
in their “Setting up multiple daemons” daemons section. I assume
webrick offers similar? Or are you considering this a different port?

Even if IIS and Webrick both support binding to just one IP address
(which I assume) then you still need two DNS names - one for each IP.
The OP did not sound as if that was what he wanted - if it’s possible
at all. Of course you could map one DNS name to both IP’s but this
might yield unpredictable results.

I’d say his easiest alternative is to run Apache on port 80; and
have it proxy some requests to some ruby server (hopefully better
than webrick - maybe mongrel) and proxy other requests to IIS running
on a different port. And then firewall off the IIS and webrick ports
of course for security reasons.

I’d say the easiest is to just run Ruby code via CGI - or just have
Webrick run on another port. With your setup you have three pieces of
software to configure, run and monitor vs. two in the other case.

Regards

robert

Maybe this can help you :
First,stop you iis,then start webrick like this:ruby script/server -p
80

On 1/13/07, Robert K. [email protected] wrote:

You actually can have two IP addresses on one NIC? Are you sure
about that? How would you configure that for example on Linux?

man ifconfig :slight_smile:

Even if IIS and Webrick both support binding to just one IP address
(which I assume) then you still need two DNS names - one for each IP.
The OP did not sound as if that was what he wanted - if it’s possible
at all.

Actually, the OP said “Now I need to host another site…” which to me
implies a unique host/domain name. So it would be easy to have his
existing ASP sites mapped to one IP and the Ruby site to another.

FWIW, my dev machines (SuSE currently, Windows in the past) always
have multiple IPs configured so I can run different server
types/versions
simultaneously for testing…

On 1/14/07, Alex Y. [email protected] wrote:

FastCGI + [apache|lighhtp], or Mongrel, perhaps.
How’s this for an idea: run Mongrel on port 80, and proxy requests that
aren’t for the Ruby site to IIS on another port? I presume IIS can’t be
configured to proxy the same way that Apache can, so why not do it the
other way around?

It is not terribly difficult to setup mod_proxy or mod_proxy_balancer to
send specific requests to IIS. There are lots of guides for configuring
mongrel with apache and mod_proxy, just swap out the idea of the mongrel
process and replace with IIS ip address.

You can do it on a host name basis with virtual hosts, or you could do
some
mod_rewrite magic and have IIS only serve .asp* requests.

Alex

HTH,
Michael G.

James B. wrote:

Or IIS. It can server Ruby up as CGI, I believe.

There’s also ActiveScriptRuby:

http://www.geocities.co.jp/SiliconValley-PaloAlto/9251/ruby/index.html

which could maybe be used as an ASP language.

How’s this for an idea: run Mongrel on port 80, and proxy requests that
aren’t for the Ruby site to IIS on another port? I presume IIS can’t be
configured to proxy the same way that Apache can, so why not do it the
other way around?

Robert K. [email protected] writes:

[ … ]

You actually can have two IP addresses on one NIC? Are you sure
about that? How would you configure that for example on Linux?

This varies slightly under different flavors of Linux. On one of the
linux boxes I use (RedHat, kernel version
2.6.9-022stab078.21-enterprise), it’s done like this:

In /etc/sysconfig/network-scripts, the following files exist (IP
addr’s changed):

ifcfg-venet0
contents:  DEVICE=venet0
           BOOTPROTO=static
           ONBOOT=yes
           IPADDR=127.0.0.1
           NETMASK=255.255.255.255
           BROADCAST=0.0.0.0

ifcfg-venet0:0
contents:  DEVICE=venet0:0
           ONBOOT=yes
           IPADDR=1.2.3.4
           NETMASK=255.255.255.255

ifcfg-venet0:1
contents:  DEVICE=venet0:1
           ONBOOT=yes
           IPADDR=1.2.3.5
           NETMASK=255.255.255.255

ifcfg-venet0:2
contents:  DEVICE=venet0:2
           ONBOOT=yes
           IPADDR=1.2.3.6
           NETMASK=255.255.255.255

ifcfg-venet0:3
contents:  DEVICE=venet0:3
           ONBOOT=yes
           IPADDR=1.2.3.7
           NETMASK=255.255.255.255

This sets up 127.0.0.1 plus four other IP’s.

Also, the following fragment exists in the standard, non-modified
version of /etc/init.d/network that’s in use at my site:

[ ... etc. ... ]

cd /etc/sysconfig/network-scripts

. network-functions

# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup 

files
interfaces=ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|rpmsave|rpmorig|rpmnew)' | \ LANG=C egrep -v '(~|\.bak)$' | \ LANG=C egrep 'ifcfg-[A-Za-z0-9\._-]+$' | \ sed 's/^ifcfg-//g'

[ ... etc. ... ]

Later in the script, the $interfaces variable is searched for all
valid interfaces to start up.

That machine has a single NIC which is configured to listen on multiple
IP’s. The server farm which manages this machine routes the four IP
addresses to this host. I’m pretty sure that it’s not necessary to have
a special NIC for this.

Maybe this can help you :
First,stop you iis,then start webrick like this:ruby script/server -p
80
Hassan S. wrote:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs