简体   繁体   中英

How to access my application running on tomcat server using IP address instead of localhost

I am trying to access my web application deployed in tomcat server using IP address instead of localhost. I am trying to access the address from the same PC where the application was deployed. Interestingly, it worked for me at my work wi-fi network but not in my home network. I have already seen

How to run a Apache Tomcat Webserver on my PC and access if from a real Android Device?

why tomcat instance running by tomcat is only visible with localhost address not with my real network ip?

Does this have something to do with my firewall settings or router settings. If so can someone provide detailed pointers on what has to be done?

Please try this:

In the File configuration Httpd.conf of Apache the line that serves (File of Connector) to Tomcat (Suppose in Windows):

Include ".../Tomcat/conf/auto/mod_jk.conf"

In the file mod_jk.conf maybe you have:

...
JkWorkersFile "...LocationOfYourWorkerFile..."
...
<VirtualHost localhost>
  ...
  ServerName localhost
  ...
  JkMount /*.jsp ajp13
</VirtualHost>

Where ajp13 is Tomcat worker defined in JkWorkersFile.

In the JkWorkersFile maybe you have:

worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
# END workers.properties

Change to in mod_jk.conf file:

<VirtualHost  *:80>
  ...
  ServerName localhost
  ...
  JkMount /*.jsp ajp13
</VirtualHost>

In this case you are saying that not only works for localhost, but also works for all ip's through 80 port.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM