users@glassfish.java.net

RE: Re: How to bind a .war file to http://localhost:80/ ?

From: Markus Karg <karg_at_quipsy.de>
Date: Tue, 8 Jul 2008 17:20:04 +0200

Wolfram,

thank you very much for your kind help. I did exactly what you said and
it works very well! :-)

But I am using "asadmin deploydir" instead of "asadmin deployd", because
GlassFish told me that "deployd" is an unknown command.

Thanks! :-)
Markus

-----Original Message-----
From: Wolfram Rittmeyer [mailto:w.rittmeyer_at_jsptutorial.org]
Sent: Sonntag, 6. Juli 2008 22:49
To: users_at_glassfish.dev.java.net
Subject: Re: How to bind a .war file to http://localhost:80/ ?

Markus KARG wrote:
> I need to bind a .war file to http://localhost:80/ (Port 80, Root
> Context) !
>
> It seems all .war's by default are bound to
> http://localhost:8080/mywarfile/ (Port 8080, Sub Context mywarfile)
>
> So my question is:
>
> How to bind this specific .war file to port 80 instead of 8080 and how

> to bind to the root / instead to subcontext /mywarfile? The default
> Context in the admin GUI is shown as "mywarfile", so I wanted to just
> empty it, but the admin GUI doesn't allow empty field.

First you have to create a virtual server for the domain to use. E.g.:
asadmin create-virtual-server --hosts www.whatever.org,whatever.org
someMeaningfulName

Then you have to define a specific listener that listens to port 80:
asadmin create-http-listener --listeneraddress 0.0.0.0 --listenerport 80

--defaultvs someMeaningfulName listenername

You have to use the name of the virtual server created in the first step

here.

Of course this wont work on any Unix-based system if GlassFish is not
run as root (which is IMHO *no* good idea). You might choose to redirect

any traffic to port 80 to port 8080 using the firewall of the system
(e.g. for Linux this is possible using iptables).

Now whenever you deploy a app you have to link this app with the virtual

server created in the first step:
asadmin deployd --virtualservers someMeaningfulName --contextroot "/"
--name someNameForYourApp whatever.war

Of course you could also use the GlassFish-sepcific deployment
descriptor sun-web.xml to set the context-root to "/".

--
Wolfram Rittmeyer
http://weblogs.java.net/blog/writtmeyer
http://www.nosilverbullet.de/blog/category/GlassFish (German only)
> Thanks a lot!
> Markus
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net