Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The example analysis of a Springboot project can be accessed without adding a port.

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the Springboot project without adding a port can also visit the project example analysis, I hope you will learn something after reading this article, let's discuss it together!

Foreword:

In actual development, we may often have such a situation. In the local springboot project, the access port of the project will be set. For example, the foreground port I set is 8443 and the background port is 8085. When our project is deployed online, if you can't access the project only by filling in the domain name, you need to add the port number at the end of the domain name, which is bound to cause some unnecessary trouble. Is there a way? You only need to access the domain name to the foreground of the corresponding project, or add guanli to the front of the domain name to access the background?

01

Resolve domain name

In the first step of setting up, you need to go to your domain name service provider to resolve the domain name. Generally, you can add two recordsets, namely www. Domain name or domain name. Suppose this is the entrance to the front desk.

How to parse the corresponding background? we just need to add a recordset, guanli. The domain name is fine.

The domain names configured in the front and background point to the address without a server address.

Now we can access the deployed project through the domain name (springboot project deployment is not listed for the time being), but you need to add the port number to the end of the domain name. As mentioned in the preface, this is troublesome. Let's take a look at how to remove the port number.

02

Modify the configuration file of nginx

The idea of modification is to direct the domain name we need to set to the domain name with the port number. For example, if my domain name is http://muxiongxiong.cn, then I need to configure to point to http://muxiongxiong.cn:8443, and the backend points the http://guanli.muxiongxiong.cn to http://muxiongxiong.cn:8085. In this way, the project can be accessed directly without the port number.

Here is the key configuration information in nginx:

# what is configured here is port 80 listening muxiongxiong.cn:8443 domain name server {listen 80; server_name muxiongxiong.cn; location / {# configure proxy access to 8080 Nginx server proxy_pass http://muxiongxiong.cn:8443; index index.html index.htm;} error_page 500502 503 504 / 50x.html Location = / 50x.html {root html;}} # what is configured here is port 80 snooping www.muxiongxiong.cn:8443 domain name server {listen 80; server_name guanli.muxiongxiong.cn; location / {# configure proxy access to 8080 Nginx server proxy_pass http://muxiongxiong.cn:8085; Index index.html index.htm;} error_page 500 502 503 504 / 50x.htl; location = / 50x.html {root html }} after reading this article, I believe you have a certain understanding of "sample analysis of Springboot projects without adding ports". If you want to know more about it, please follow the industry information channel and thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report