简体   繁体   English

仅限 Spring Boot webapp 本地主机

[英]Spring Boot webapp localhost only

Is there a way to keep the used port closed for a Spring Boot webapp?有没有办法让 Spring Boot webapp 使用的端口保持关闭? Currently, I can access from localhost and from the rest of the machines in the local network.目前,我可以从本地主机和本地网络中的其他机器访问。 The objective is to only be able to access the webapp locally.目标是只能在本地访问 webapp。

Alright, other than setting up a firewall, you can bind your server to localhost.好吧,除了设置防火墙,您可以将您的服务器绑定到本地主机。

This is done by placing这是通过放置

server.address=127.0.0.1

Inside the application.properties file in resources在资源中的 application.properties 文件中

Explanation about this and additional allowed values can be found in the following resource: (for "embedded server" specific parameters, see section " EMBEDDED SERVER CONFIGURATION(ServerProperties) "可以在以下资源中找到有关此和其他允许值的说明:(对于“嵌入式服务器”特定参数,请参阅“嵌入式服务器配置(ServerProperties) ”部分

allowed values in application.properties application.properties 中的允许值

Adding to @Dani Cuesta's answer:添加到@Dani Cuesta 的回答中:

you add the: server.address=127.0.0.1你添加: server.address=127.0.0.1

Explanation about this and additional allowed values can be found in the following resource: (for "embedded server" specific parameters, see section " EMBEDDED SERVER CONFIGURATION(ServerProperties) "可以在以下资源中找到有关此和其他允许值的说明:(对于“嵌入式服务器”特定参数,请参阅“嵌入式服务器配置(ServerProperties) ”部分

allowed values in application.properties application.properties 中的允许值

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

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