同一服务器中的两个 tomcat - 新贵脚本 Ubuntu 服务器

Two tomcat in same server - Upstart Script Ubuntu Server

我在我的服务器上安装了两个版本的tomcat,我遵循了DigitalOcean Tutorial,它教如何安装和配置新贵脚本,但我需要两个版本的[=62] =] 7 和 8.

Tomcat 8 安装在以下路径:

/opt/tomcat

和Tomcat7

/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 

Using CATALINA_BASE: /opt/tomcat7 Using CATALINA_HOME: /opt/tomcat7 Using CATALINA_TMPDIR: /opt/tomcat7/temp Using JRE_HOME: /usr Using CLASSPATH: /opt/tomcat7/bin/bootstrap.jar:/opt/tomcat7/bin/tomcat-juli.jar Tomcat started.

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

谢谢!