Ubuntu 14.04 tomcat配置

Posted on 2017-04-12 13:33  小小蜗牛灬  阅读(257)  评论(0编辑  收藏  举报
  1. 在tomcat-users.xml中添加了以下代码即可
  2.   <role rolename="tomcat"/>  
  3.   <role rolename="role1"/>  
  4.   <role rolename="manager-gui"/>  
  5.   <user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>  
  6.   <user username="both" password="tomcat" roles="tomcat,role1"/>  
  7.   <user username="role1" password="tomcat" roles="role1"/>  

 

配置tomcat 开启启动:

  1. cd /etc/init.d

  2. sudo vi tomcat6

  

#!/bin/sh

### BEGIN INIT INFO
# Provides:          tomcat
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the tomcat web server
# Description:       starts tomcat using start-stop-daemon
### END INIT INFO

#tomcat auto-start

export JAVA_HOME="/usr/lib/jvm/jdk1.7.0_21"
export CATALINA_HOME="/home/ubuntu/tomcat6"

case $1 in
start)
 sh /home/ubuntu/tomcat6/bin/startup.sh
 ;;

stop)
 sh /home/ubuntu/tomcat6/bin/shutdown.sh
 ;;

restart)
 sh /home/ubuntu/tomcat6/bin/shutdown.sh
 sh /home/ubuntu/tomcat6/bin/startup.sh
 ;;
*)
 echo 'Usage:tomcat6 start|stop|restart'
 ;;
esac
exit 0

  

3. 设置为可执行:sudo chmod +x tomcat6

4. 加入自启动任务:sudo update-rc.d tomcat6 defaults

 

Copyright © 2024 小小蜗牛灬
Powered by .NET 9.0 on Kubernetes