Farewell to the port number and project name -- tomcat directly uses an ip address to access the website, and the port number is tomcat
Lightweight has always been a trend in the development of software. It is also the same for domain names. domain names are now being simplified, such as t. tt
Although we do not have our own domain name, we can also have a short and concise addiction. Hey hey ~
For example, projects on the server are generally accessed through http: // ip: Port Number/project name, which is too long and troublesome.
Which parts can be removed?
Ip addresses cannot be removed, but we can use the idea of domain names, that is, to allow our computers to map a simple string to an ip address, which simplifies the process ~
What about the port number? We know that the default port number of the Web Browser Service is 80, so you only need to configure the port number of the tomcat server to 80, then you can omit ~
What if there is a project name? We can also use the tomcat configuration file "slightly applying the subtotal" to easily solve this problem.
The following three steps are involved:
When using the host file, we access a domain name. First, we will go to the local host file to find the ing relationship. If we cannot find it, we will go to the dns server to find it, therefore, we configure a local domain name in the host.
Find the host file (take a 32-bit system as an example. The host file is in the C: \ Windows \ System32 \ drivers \ etc directory), and add only one line:
127.0.0.1zhu
Remove port number
Open the server. xml file in the conf directory under tomcat and find the following section (about 69 lines ):
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>
8080 is the access port of tomcat, so you can change it to 80.
Remove project name
Open the server. xml file in the conf directory under tomcat and find the following section (about 128 lines ):
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
Add the following statement to line feed under <Host ......> to redirect localhost or ip address to your directory.
<Context path="" docBase="Mobile" debug="0" reloadable="true"/>
Here the Context tag represents a web application, where docBase fills in your project name. Because the path is set to "", you do not need to specify the project name.
Go and try it ~ Now you only need to access your project through http: // zhu. Is it cool ~