Tomcat service IP cannot be accessed, localhost can be accessed

Tomcat service IP cannot be accessed, localhost can be accessed

Background description

After the web project published in Tomcat is successfully published, it is normal to access the project through localhost. However, 127.0.0.1 cannot be accessed.

the reason

After analysis, the reason is that there is a problem with the IP address bound to Tomcat. Through ping localhost, it is found that the IPV6 ip is bound, and the result is:::1

Solution

In the server.xml of tomcat, modify the connector configuration and add address="0.0.0.0" to bind it to IPV4. details as follows:

<Connector port="8543" address="0.0.0.0" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
			   clientAuth="false" sslProtocol="TLS"
			   keystoreFile="D:\cas\keystore\java1234.keystore"
			   keystorePass="666666"/>

Guess you like

Origin blog.csdn.net/Asia1752/article/details/109838492