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
>