Re: Best practice for running Tomcat on port 80
On 09/09/2010 04:30, jan gestre wrote: On Tue, Sep 7, 2010 at 3:40 PM, Pid p...@pidster.com wrote: On 07/09/2010 06:14, jan gestre wrote: On Tue, Sep 7, 2010 at 1:02 PM, Wesley Acheson wesley.ache...@gmail.com wrote: On Tue, Sep 7, 2010 at 4:34 AM, jan gestre ipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Conveniently, the binary you need is included in tomcat/bin: commons-daemon-native.tar.gz I'll assume Linux, as you didn't state explicitly which OS you're using. tar -zxvf commons-daemon-native.tar.gz cd commons-daemon-1.0.2-native-src more RELEASE-NOTES.txt cd unix more INSTALL.txt ... follow the instructions therein. p Hi Pid, I've followed your instructions and was able to create the executable jsvc however I don't know the next step, should I incorporate jsvc to tomcat's init.d script, and change server.xml respectively? If yes, how will I do it? Tomcat is running as an unprivilege user. There's examples of shell scripts called Tomcat.sh, Tomcat5.sh in the unix directory subtree, which may help. Use Tomcat5.sh as a template. It demonstrates how to use configure the jsvc binary. p Here is my tomcat start up file and server.xml if it matters #!/bin/bash # # tomcat Starts Tomcat Java server. # # # chkconfig: 345 88 12 # description: Tomcat is the server for # Java servlet applications. ### BEGIN INIT INFO # Provides: $tomcat ### END INIT INFO JAVA_HOME=/usr/java/jdk1.6.0_21 export JAVA_HOME TOMCAT_HOME=/usr/src/tomcat/bin START_TOMCAT=/usr/src/tomcat/bin/startup.sh STOP_TOMCAT=/usr/src/tomcat/bin/shutdown.sh # Source function library. . /etc/init.d/functions [ -f $START_TOMCAT ] || exit 0 [ -f $STOP_TOMCAT ] || exit 0 RETVAL=0 umask 077 start() { echo -n $Starting Tomcat Java server: daemon su -c $START_TOMCAT tomcat echo return $RETVAL } stop() { echo -n $Shutting down Tomcat Java server: daemon su -c $STOP_TOMCAT tomcat echo return $RETVAL } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $Usage: $0 {start|stop|restart} exit 1 esac exit $? 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Best practice for running Tomcat on port 80
There's examples of shell scripts called Tomcat.sh, Tomcat5.sh in the unix directory subtree, which may help. Use Tomcat5.sh as a template. It demonstrates how to use configure the jsvc binary. p Hi Pid, I was able to start Tomcat by using Tomcat5.sh just like you suggested but I have another issue, how do I start it at boot time just like when Tomcat was using port 8080. Many thanks! Jan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best practice for running Tomcat on port 80
On Thu, 2010-09-09 at 22:12 +0800, jan gestre wrote: There's examples of shell scripts called Tomcat.sh, Tomcat5.sh in the unix directory subtree, which may help. Use Tomcat5.sh as a template. It demonstrates how to use configure the jsvc binary. p Hi Pid, I was able to start Tomcat by using Tomcat5.sh just like you suggested but I have another issue, how do I start it at boot time just like when Tomcat was using port 8080. Many thanks! Jan There is a config file called server.xml which i think is responsible. - Frank TZ _ University Computing Centre - 'Professionalism, Customer Care and Technological foresight'
Re: Best practice for running Tomcat on port 80
On 09/09/2010 15:12, jan gestre wrote: There's examples of shell scripts called Tomcat.sh, Tomcat5.sh in the unix directory subtree, which may help. Use Tomcat5.sh as a template. It demonstrates how to use configure the jsvc binary. p Hi Pid, I was able to start Tomcat by using Tomcat5.sh just like you suggested but I have another issue, how do I start it at boot time just like when Tomcat was using port 8080. You can tweak the script to be chkconfig compatible (with the one you were using previously), and install it as a startup script. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Best practice for running Tomcat on port 80
On 09/09/2010 15:42, Frank Tilugulilwa wrote: On Thu, 2010-09-09 at 22:12 +0800, jan gestre wrote: There's examples of shell scripts called Tomcat.sh, Tomcat5.sh in the unix directory subtree, which may help. Use Tomcat5.sh as a template. It demonstrates how to use configure the jsvc binary. p Hi Pid, I was able to start Tomcat by using Tomcat5.sh just like you suggested but I have another issue, how do I start it at boot time just like when Tomcat was using port 8080. Many thanks! Jan There is a config file called server.xml which i think is responsible. Nope. Sorry. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Best practice for running Tomcat on port 80
On Tue, Sep 7, 2010 at 3:40 PM, Pid p...@pidster.com wrote: On 07/09/2010 06:14, jan gestre wrote: On Tue, Sep 7, 2010 at 1:02 PM, Wesley Acheson wesley.ache...@gmail.com wrote: On Tue, Sep 7, 2010 at 4:34 AM, jan gestre ipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Conveniently, the binary you need is included in tomcat/bin: commons-daemon-native.tar.gz I'll assume Linux, as you didn't state explicitly which OS you're using. tar -zxvf commons-daemon-native.tar.gz cd commons-daemon-1.0.2-native-src more RELEASE-NOTES.txt cd unix more INSTALL.txt ... follow the instructions therein. p Hi Pid, I've followed your instructions and was able to create the executable jsvc however I don't know the next step, should I incorporate jsvc to tomcat's init.d script, and change server.xml respectively? If yes, how will I do it? Tomcat is running as an unprivilege user. Here is my tomcat start up file and server.xml if it matters #!/bin/bash # # tomcat Starts Tomcat Java server. # # # chkconfig: 345 88 12 # description: Tomcat is the server for # Java servlet applications. ### BEGIN INIT INFO # Provides: $tomcat ### END INIT INFO JAVA_HOME=/usr/java/jdk1.6.0_21 export JAVA_HOME TOMCAT_HOME=/usr/src/tomcat/bin START_TOMCAT=/usr/src/tomcat/bin/startup.sh STOP_TOMCAT=/usr/src/tomcat/bin/shutdown.sh # Source function library. . /etc/init.d/functions [ -f $START_TOMCAT ] || exit 0 [ -f $STOP_TOMCAT ] || exit 0 RETVAL=0 umask 077 start() { echo -n $Starting Tomcat Java server: daemon su -c $START_TOMCAT tomcat echo return $RETVAL } stop() { echo -n $Shutting down Tomcat Java server: daemon su -c $STOP_TOMCAT tomcat echo return $RETVAL } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $Usage: $0 {start|stop|restart} exit 1 esac exit $? - server.xml ?xml version='1.0' encoding='utf-8'? Server port=8005 shutdown=SHUTDOWN Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on / Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.core.JreMemoryLeakPreventionListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener / Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener / GlobalNamingResources Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / /GlobalNamingResources Service name=Catalina Connector port=8080 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443 / Connector port=8009 protocol=AJP/1.3 redirectPort=8443 / Engine name=Catalina defaultHost=localhost Realm className=org.apache.catalina.realm.UserDatabaseRealm resourceName=UserDatabase/ Host name=localhost appBase=webapps unpackWARs=true autoDeploy=true xmlValidation=false xmlNamespaceAware=false /Host /Engine /Service /Server - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best practice for running Tomcat on port 80
On 07/09/2010 06:14, jan gestre wrote: On Tue, Sep 7, 2010 at 1:02 PM, Wesley Acheson wesley.ache...@gmail.com wrote: On Tue, Sep 7, 2010 at 4:34 AM, jan gestre ipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Conveniently, the binary you need is included in tomcat/bin: commons-daemon-native.tar.gz I'll assume Linux, as you didn't state explicitly which OS you're using. tar -zxvf commons-daemon-native.tar.gz cd commons-daemon-1.0.2-native-src more RELEASE-NOTES.txt cd unix more INSTALL.txt ... follow the instructions therein. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Best practice for running Tomcat on port 80
On 07/09/2010 03:34, jan gestre wrote: Hi Everyone, I've Googled a lot with respect to the subject, and I wanted to solicit your advice, basically I want to run Tomcat on port 80, some already objected to the idea of proxying it via Apache, so I'm looking at using jsvc or pound instead. I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. Your options are, (in no particular order): 1. A proxy server (httpd) 2. A service wrapper (e.g. jsvc) 3. Port forwarding (iptables) 1. HTTPD / proxy The first isn't a bad idea, but would probably be a better choice if you have other reasons for choosing it, e.g. PHP, load balancing. 2. JSVC Included with the Tomcat distribution, so easy to deploy. 3. Iptables Actually, remarkably simple to implement. Should be properly documented within your organisation because it might be hard to discover for less familiar users. There's no best practice per se, you need to understand the options and make the most suitable choice for your organisation. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Best practice for running Tomcat on port 80
On 07.09.2010 09:40, Pid wrote: On 07/09/2010 06:14, jan gestre wrote: On Tue, Sep 7, 2010 at 1:02 PM, Wesley Achesonwesley.ache...@gmail.com wrote: On Tue, Sep 7, 2010 at 4:34 AM, jan gestreipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Conveniently, the binary you need is included in tomcat/bin: binary - source for the binary commons-daemon-native.tar.gz I'll assume Linux, as you didn't state explicitly which OS you're using. tar -zxvf commons-daemon-native.tar.gz cd commons-daemon-1.0.2-native-src more RELEASE-NOTES.txt cd unix more INSTALL.txt ... follow the instructions therein. Addition: Unfortunately the release of commons-daemon bundled with TC 6.0.29 contains some garbage that disturbs the build procedure. See https://issues.apache.org/bugzilla/show_bug.cgi?id=49674 and https://issues.apache.org/jira/browse/DAEMON-154 So in addition to the documented build procedure the solution is to run make clean before make. Since in the meantime the next version of commons-daemon has been released and will be used by the next TC version, this time because of the broken tarball it might make more sense to directly download and build commons-daemon 1.0.3: http://commons.apache.org/daemon/download_daemon.cgi Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best practice for running Tomcat on port 80
On 7.9.2010 9:51, Pid wrote: 3. Iptables Actually, remarkably simple to implement. Should be properly documented within your organisation because it might be hard to discover for less familiar users. If you are talking about NAT, like in this example: = *nat :OUTPUT ACCEPT [93:16135] :POSTROUTING ACCEPT [93:16135] :PREROUTING ACCEPT [2:759] -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8443 COMMIT - I would add that it have two drawbacks: 1. NAT is not supported in ip6tables (IPv6 version of iptables), and probably never will be 2. Virtual hosts with https might serve wrong certificates JSVC, on the other hand, worked fine for me. Regards, Ognjen - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best practice for running Tomcat on port 80
On Tue, Sep 7, 2010 at 4:34 AM, jan gestre ipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Regards, Wes - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Best practice for running Tomcat on port 80
On Tue, Sep 7, 2010 at 1:02 PM, Wesley Acheson wesley.ache...@gmail.com wrote: On Tue, Sep 7, 2010 at 4:34 AM, jan gestre ipcopper...@gmail.com wrote: I'm using the latest 6.0.29 binary distribution, and I don't have an idea where to download jsvc, if it's already included I don't know the location, could someone please enlighten me on how to do this. It can be downloaded as part of this bundle http://commons.apache.org/daemon/download_daemon.cgi. Instructions are here http://commons.apache.org/daemon/jsvc.html. Dunno how to use it even after reading the instructions though. Regards, Wes - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Thanks Wes, I was able to locate that file earlier however even after reading the instructions just like you've said I don't know what's next. Based on this -- http://www.dpawson.co.uk/tomcat/linux.html , the commons-daemon.jar is already in $CATALINA_HOME/bin but inspite of the author downloaded and compiled the aforementioned. I'm confused. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org