linux下部署SpringBoot启动失败问题

1. 问题概要

  :在开发时候为了方便将Tomcat的端口改为了80端口

  在Linux部署SpringBoot项目(非ROOT用户)执行

java -jar hemu.jar

  出现

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 80 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 80, or configure this application to listen on another port.

  检查发现也没有程序占用80端口

  通过搜索在StackOverflow发现了如下回答。

On linux ports below 1024 can be opened only by root, so the port 80 is restricted by default
if you want to publish your app on 80 port you need to redirect request from port 80 to the port you gonna run your springapp (e.g 8080) port
you can use apache2 server wich is allowed by default to work on port 80 and can forward requests for you to tomcat

  链接:

https://stackoverflow.com/questions/44635109/the-tomcat-connector-configured-to-listen-on-port-80-failed-to-start

解决方式

1.1 在命令前添加sudo

sudo java -jar hemu.jar

1.2 使用root账户启动

1.3 将配置文件service.port的值由80改为1024以外的值 如默认的8080端口

1.4非root账户不允许开1024以下的端口

你可能感兴趣的:(SpringBoot)