• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Change host name

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Tomcat Gurus!

How do I change the host name of a Tomcat server?
The problem Im having is that Ive got several development environments and they all have their own names. I want these environment names to be reflected by the respective Tomcat installations as well.

For example on my local installation I might want to be able to access my webapps using a different URL such as:
http://mylocalhost:8080

Im guessing that this setting is set in server.xml ... but I cant get it to work as expected.

Kind regards
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not really possible to create separate hostnames for different applications or different Tomcat installations on the same server.

The hostname is the name of the computer itself in the IP network, it is not something that is configured in Tomcat. The name "localhost" is a special hostname, which is hardwired to the IP address 127.0.0.1, which always means "this computer".

If you want your computer to have a different hostname on the network, then you must configure the DNS (Domain Name Service) server which translates hostnames to IP addresses, but this is usually not something you can do yourself (your Internet service provider or network administrator can do this for you).

If you want to use alternative hostnames locally only (only on the computer itself, not useable when you connect from another computer), then you can edit the file C:\Windows\System32\drivers\etc\hosts. Add a line like this, for example:

127.0.0.1mymachine

and then you can connect via http://mymachine:8080

But note that you cannot use this to separate webapps or Tomcat installations with different names.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic