我在服务器上安装了两个版本的tomcat,然后按照DigitalOcean Tutorial进行操作,该课程教您如何安装和配置upstart脚本,但是我需要两个版本的Tomcat 7和Tomcat 7。

Tomcat 8安装在以下路径中:

/opt/tomcat


和Tomcat 7

/opt/tomcat7


我遵循了有关安装的所有步骤。 Tomcat 8在端口8080上可以正常工作,但是tomcat 7不能正常工作。

已编辑

当我尝试运行"sudo initctl start tomcat7"时,显示以下消息"tomcat7 start/running, process 24621",但是当尝试重新启动"sudo initctl restart tomcat7"时,消息为initctl: Unknown instance:

我已经通过脚本init-checkconf /etc/init/tomcat7.conf的测试,没问题File /etc/init/tomcat7.conf: syntax ok

http://myIp:8080 tomcat 8 is ok
http://myIp:8081 tomcat 7 dont't open on browser


我认为我的配置不正确。

Tomcat 8配置:

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">

  <Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

  </Service>
</Server>


/etc/init/tomcat.conf

description "Tomcat Server"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat
  setgid tomcat

  env JAVA_HOME=/usr/lib/jvm/java-8-oracle
  env CATALINA_HOME=/opt/tomcat

  # Modify these options as needed
  env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
  env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

  exec $CATALINA_HOME/bin/catalina.sh run

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_HOME/temp/*
  end script


和...

Tomcat 7配置:

<?xml version='1.0' encoding='utf-8'?>

<Server port="8006" shutdown="SHUTDOWN">

  <Service name="Catalina">

    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8444" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />

  </Service>
</Server>


/etc/init/tomcat7.conf

description "Tomcat Server"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat
  setgid tomcat

  env JAVA_HOME=/usr/lib/jvm/java-8-oracle
  env CATALINA_HOME=/opt/tomcat7

  # Modify these options as needed
  env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
  env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

  exec $CATALINA_HOME/bin/catalina.sh run

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_HOME/temp/*
  end script


有人知道如何进行正确的安装,在此先感谢您!

最佳答案

我运行了手动模式并工作:

sudo /opt/tomcat7/bin/startup.sh



  使用CATALINA_BASE:/ opt / tomcat7使用CATALINA_HOME:/ opt / tomcat7
  使用CATALINA_TMPDIR:/ opt / tomcat7 / temp使用JRE_HOME:/ usr使用
  类路径:
  /opt/tomcat7/bin/bootstrap.jar:/opt/tomcat7/bin/tomcat-juli.jar Tomcat
  开始。


如有必要,请随时重新打开此问题!

谢谢!

关于tomcat - 同一台服务器中的两个tomcat-Upstart脚本Ubuntu Server,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34169861/

10-11 03:59