简体   繁体   English

Spring 引导嵌入式 tomcat 中是否有用于 https 重定向的特定端口?

[英]Is there any specific port for https redirection in Spring Boot embedded tomcat?

I already have a tomcat server running in a VM with port as 443 and redirect port as 8443. Can I configure the redirect port for spring boot application also as 8443 and run in same VM?我已经有一个 tomcat 服务器在端口为 443 和重定向端口为 8443 的 VM 中运行。我可以将 spring 引导应用程序的重定向端口也配置为 8443 并在同一 VM 中运行吗? Would I face error like port already in use?我会面临像端口已经在使用的错误吗? If yes, are there any specific port to be used for this purpose?如果是,是否有任何特定端口可用于此目的? I would not like to try since this is a production environment VM.我不想尝试,因为这是一个生产环境 VM。

By default the https port used is 9393 in springboot.So, in your application if you need it to be 8443, you need to configure it in the application.properties or application.yml like application.yml默认情况下,springboot中使用的https端口是9393所以,在你的应用程序中,如果你需要它是8443,你需要在application.propertiesapplication.yml中配置它,如application.yml

server:
  port: 8443 

or application.propertiesapplication.properties

server.port=8443

Yes, you will have issues if some other application is using the same https port on the same VM, you will have to find a port that is not used by any other application and assign it for your springboot application.是的,如果其他应用程序在同一 VM 上使用相同的 https 端口,您将遇到问题,您必须找到任何其他应用程序未使用的端口并将其分配给您的 springboot 应用程序。 Check in your vm if any other application is already mapped to this port, if not you can use this port without any issues.如果任何其他应用程序已映射到此端口,请检查您的 vm,如果没有,您可以使用此端口而不会出现任何问题。

Please note that:请注意:

If HTTPS is enabled, it will completely replace HTTP as the protocol over which the REST endpoints and the Data Flow Dashboard interact.如果启用 HTTPS,它将完全取代 HTTP 作为 REST 端点和数据流仪表板交互的协议。 Plain HTTP requests will fail - therefore, make sure that you configure your Shell accordingly.普通的 HTTP 请求将失败 - 因此,请确保相应地配置 Shell。

Spring doc . Spring 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM