In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to set the default server and access without port name in Tomcat7.0, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Prepare the conditions, create a new web project, deploy to the tomcat7.0 server, using the tool Eclipse.
Step 1: set up the welcome page for the WEB project
There is a web.xml file under the WEB-INF folder (the recently created project does not contain this file, so you can create it manually). Set it in the welcome-file-list node as follows
Test.html
In this way, you used to access http://192.168.0.108:8080/MyWebService/test.html, in a browser and now you can access test.html as long as you access http://192.168.0.108:8080/MyWebService.
Step 2: go to port access
When accessing the IP+ above, you need to add the port number of IP+ to access the tomcat correctly. Now we need to remove the port and use http://192.168.0.108 to access the local server.
As shown in the figure, there is a configuration project for Service in Eclipse:
Open the server.xml file, find the Connector node, and find that the default port is 8080, changing it to port 80.
At this point, all you need to access the test.html of the above project is this: http://192.168.0.108/MyWebService
Step 3: set the default server for tomcat
Now that we want to do this, we can open test.html by accessing http://192.168.0.108, and we also need to set up the default server.
Open the server.xml file as above and find the Host node (usually at the end). If you have already add the project in tomcat, there should be a Context node in the host node, which represents the project name and path added to the server.
The code is modified as follows:
The comment is the previous direct add into the project configuration, the following is the modified, note: source= "org.eclipse.jst.jee.server:MyWebService" this sentence can not be omitted, otherwise the server startup error, can not find the specific project.
At this point, visit http://192.168.0.108 and you can open test.html.
Step 4: configure domain name resolution
If you have previously applied for an Aliyun domain name, just go to the management platform to find the domain name resolution, and add the local ip to the domain name resolution.
You do not need to have a port. You can access port 80 by default. You can click the beginner's instructions to add the resolution ip. The DNS does not need to be modified (if it has not been modified before). Then you can access the test.html by accessing the www.xxx.com locally. Here, you can only access it locally. If you want to access the CVM in public network, you need to purchase Ali's CVM and configure it.
Thank you for reading this article carefully. I hope the article "how to set the default server and access without port name in Tomcat7.0" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.