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

How to access a project on tomcat without adding a project name or 8080 port number

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to access projects on tomcat without adding project name or 8080 port number". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to access projects on tomcat without adding a project name or 8080 port number.

1. How to access the project on tomcat only through IP address or domain name without adding the project name

First open the server.xml file of tomcat (those who are not familiar with vi operation can learn)

Vi wocloud/apache-tomcat-9.0.19/conf/server.xml

Find the following paragraph

Add at the end

Just restart Tomcat.

two。 How to access the server directly through the ip address or domain name without adding the port number 8080

Reason: apache is deployed under Linux. For security, we use non-root users to launch, but the 80 port number cannot be accessed directly when the domain name is bound. As we all know, under unix, non-root users cannot listen to port numbers below 1024, and the apache server cannot be bound under port 80. Therefore, we need to use linux's port forwarding mechanism to transfer all service requests to port 80 to port 8080.

What should we do? Just run the command under your root account:

Iptables-t nat-A PREROUTING-p tcp-- dport 80-j REDIRECT-- to-port 8080

Transfer all service requests to port 80 to port 8080.

In addition, if the firewall is restarted, the command will fail, and you can use the following command to save the rule to iptables.

Service iptables save so far, I believe you have a deeper understanding of "how to access projects on tomcat without adding a project name or 8080 port number". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Internet Technology

Wechat

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

12
Report