You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Baty <ba...@yahoo.com> on 2008/01/05 16:29:30 UTC

Running Tomcat as Standalone in linux

Hi guys,
I want to serve a site with few graphics so I decided to use Tomcat 5.5 as my server.  But I'm having difficulty getting  it to  run on port 80.  I read http://www.ibm.com/developerworks/java/library/l-secjav.html and decided to try xinetd.  I added this to /etc/xinetd/:
# Redirects any port 80 requests to port 8180 (to Tomcat)
service tomcat
{
    socket_type    = stream
    protocol    = tcp
    user        = root
    wait        = no
    port        = 80
    redirect    = localhost 8180
    disable        = no
}
it works great on that machine if I point my browser but remotely I get zilch.  I've tried plugging in my ip address instead of localhost: zilch.  Could anyone point me in the right  direction?
Thanks.
Chris




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

RE: Running Tomcat as Standalone in linux

Posted by Martin Gainty <mg...@hotmail.com>.
verify the listen address is broadcasting on port 80 on the web-server e.g.?netstat -a | grep 80Martin______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Sat, 5 Jan 2008 23:49:13 +0800> From: ampyx.li@gmail.com> To: users@tomcat.apache.org> Subject: Re: Running Tomcat as Standalone in linux> > Check out your log see if there is any error info.> > On Jan 5, 2008 11:29 PM, Chris Baty <ba...@yahoo.com> wrote:> > > Hi guys,> > I want to serve a site with few graphics so I decided to use Tomcat 5.5 as> > my server. But I'm having difficulty getting it to run on port 80. I> > read http://www.ibm.com/developerworks/java/library/l-secjav.html and> > decided to try xinetd. I added this to /etc/xinetd/:> > # Redirects any port 80 requests to port 8180 (to Tomcat)> > service tomcat> > {> > socket_type = stream> > protocol = tcp> > user = root> > wait = no> > port = 80> > redirect = localhost 8180> > disable = no> > }> > it works great on that machine if I point my browser but remotely I get> > zilch. I've tried plugging in my ip address instead of localhost: zilch.> > Could anyone point me in the right direction?> > Thanks.> > Chris> >> >> >> >> >> > ____________________________________________________________________________________> > Be a better friend, newshound, and> > know-it-all with Yahoo! Mobile. Try it now.> > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ> >
_________________________________________________________________
Make distant family not so distant with Windows Vista® + Windows Live™.
http://www.microsoft.com/windows/digitallife/keepintouch.mspx?ocid=TXT_TAGLM_CPC_VideoChat_distantfamily_012008

Re: Running Tomcat as Standalone in linux

Posted by Li <am...@gmail.com>.
Check out your log see if there is any error info.

On Jan 5, 2008 11:29 PM, Chris Baty <ba...@yahoo.com> wrote:

> Hi guys,
> I want to serve a site with few graphics so I decided to use Tomcat 5.5 as
> my server.  But I'm having difficulty getting  it to  run on port 80.  I
> read http://www.ibm.com/developerworks/java/library/l-secjav.html and
> decided to try xinetd.  I added this to /etc/xinetd/:
> # Redirects any port 80 requests to port 8180 (to Tomcat)
> service tomcat
> {
>    socket_type    = stream
>    protocol    = tcp
>    user        = root
>    wait        = no
>    port        = 80
>    redirect    = localhost 8180
>    disable        = no
> }
> it works great on that machine if I point my browser but remotely I get
> zilch.  I've tried plugging in my ip address instead of localhost: zilch.
>  Could anyone point me in the right  direction?
> Thanks.
> Chris
>
>
>
>
>
>  ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>

Re: Running Tomcat as Standalone in linux

Posted by Brian Millett <bm...@gmail.com>.
Chris Baty escribío:
> Hi guys,
> I want to serve a site with few graphics so I decided to use Tomcat 5.5 as my server.  But I'm having difficulty getting  it to  run on port 80.  I read http://www.ibm.com/developerworks/java/library/l-secjav.html and decided to try xinetd.  I added this to /etc/xinetd/:
> # Redirects any port 80 requests to port 8180 (to Tomcat)
> service tomcat
> {
>     socket_type    = stream
>     protocol    = tcp
>     user        = root
>     wait        = no
>     port        = 80
>     redirect    = localhost 8180
>     disable        = no
> }
> it works great on that machine if I point my browser but remotely I get zilch.  I've tried plugging in my ip address instead of localhost: zilch.  Could anyone point me in the right  direction?
> Thanks.
> Chris
> 
> 
> 
> 
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
> 


You can also use the java service launcher that is located in the bin directory 
of the distribution.  You need to compile it and install it.  What it does is 
launch tomcat on port 80 as root, but changes the owner to be something else, 
like 'tomcat'.  That way, you can run it on port 80, but not as root.

A way of launching it from say /etc/init.d is with a script like the following:


#!/bin/sh
#
# chkconfig: 345 86 15
# description: Tomcat Server
#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
#               port="80" minProcessors="5" maxProcessors="75"
#               enableLookups="true" redirectPort="8443"
#               acceptCount="10" debug="0" connectionTimeout="60000"/>
#
#
# Adapt the following lines to your configuration
JAVA_HOME=/usr/jdk
CATALINA_HOME=/opt/tomcat
CATALINA_BASE=/opt/webBaseDir
DAEMON_HOME=/usr/local/bin
TOMCAT_USER=tomcat
TMP_DIR=$CATALINA_BASE/temp
CATALINA_OPTS=" -Djava.library.path=/usr/local/apr/lib
  -Djava.awt.headless=true
  -Xms128M -Xmx512M
  -XX:+UseParallelOldGC
"
CLASSPATH=\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/tomcat-juli.jar:\
$CATALINA_HOME/bin/bootstrap.jar

case "$1" in
   start)
     #
     # Start Tomcat
     #
     $DAEMON_HOME/jsvc \
     -user $TOMCAT_USER \
     -home $JAVA_HOME \
     -jvm server \
     -Dcatalina.home=$CATALINA_HOME \
     -Dcatalina.base=$CATALINA_BASE \
     -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
     -Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
     -Djava.endorsed.dirs=$CATALINA_BASE/endorsed \
     -Djava.io.tmpdir=$TMP_DIR \
     -outfile $CATALINA_BASE/logs/catalina.out \
     -errfile '&1' \
     $CATALINA_OPTS \
     -cp $CLASSPATH \
     org.apache.catalina.startup.Bootstrap
     #
     # To get a verbose JVM
     #-verbose \
     # To get a debug of jsvc.
     #-debug \
     ;;

   stop)
     #
     # Stop Tomcat
     #
     PID=`cat /var/run/jsvc.pid`
     kill $PID
     ;;

   *)
     echo "Usage tomcat.sh start/stop"
     exit 1
     ;;
esac

-- 
Brian Millett - [ Ivanova, "The Geometry of Shadows"]
"If it gets too bad I'll just gnaw it off at the ankle."


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org