在 Debian 系统上,Tomcat 的启停方式取决于安装方式(apt 安装还是二进制包安装)。下面分别说明。
Debian 官方仓库中的 Tomcat(如 tomcat9、tomcat10)会使用 systemd。
sudo systemctl start tomcat9
(如果是 tomcat10,则替换为 tomcat10)
sudo systemctl stop tomcat9
sudo systemctl restart tomcat9
sudo systemctl enable tomcat9
sudo systemctl status tomcat9
如果你是从 Apache 官网下载并解压的 Tomcat:
cd /opt/tomcat/bin
./startup.sh
cd /opt/tomcat/bin
./shutdown.sh
说明:
startup.sh实际调用catalina.sh startshutdown.sh实际调用catalina.sh stop
ps -ef | grep tomcat
kill -9 <pid>
默认端口是 8080:
sudo netstat -tlnp | grep 8080
tail -f /var/log/tomcat9/catalina.out
或(apt 安装):
journalctl -u tomcat9
sudo ufw allow 8080
如果你能告诉我:
我可以给你更精确的命令。