In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How to configure a virtual host for tomcat? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
There are two ways for webmasters to configure virtual hosts with Tomcat. The source of this article is the blog Garden website, the author: fleeing the desert, I hope the sharing of knowledge will be helpful to everyone.
1. Virtual host configuration based on hostname
Create a directory under an arbitrary drive letter as a directory for a virtual address. For example: F:\ virtualhost1, create a test1.html under it and write content, such as test. Add the following configuration section to the tomcat/conf/service.xml
Open the hosts file under C:\ Windows\ System32\ drivers\ etc and add 127.0.0.1 site1
Suppose that hello.html content is written to hello under the ROOT folder under tomcat and wenbapps.
Start tomcat, enter: http://localhost:8080/index.html-to display hello in the browser, access the resources under tomcat; enter: http://site1:8080/index.html-to display test in the browser, and access the resources under F:\ virtualhost1.
In fact, the ip of both is the same, 127.0.0.1, but it implements access to resources on two "hosts", one under tomcat and the other under F disk.
two。 Port-based virtual host configuration
Create a directory under an arbitrary drive letter as a directory for a virtual address. For example: F:\ virtualhost2, create test1.html under it, and write content such as test2
Add a section of configuration to the tomcat/service.xml, as follows
…… .
The configuration here is also existing in the file, and the following is added.
Because it is a port-based configuration, port 8082 here is new and will be used for future access
Start tomcat and type http://localhost:8080/index.html-will display the contents of tomcat/webapps/ROOT/index.html; enter http://localhost:8082/index.html-will display the contents of index.html under F:\ virtualhost2.
Here, it is realized through different ports, and different virtual space configurations based on different ports.
After reading the above, have you mastered how to configure a virtual host for tomcat? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for 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.
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.