1

I have hosted my spring application in tomcat 7 server .tomcat 7 server that is installed in our own server.our server ip address already map with domain.for now how to map a domain for my spring application. for now i am accessing url like http:ipaddress:100/appname

R.Anandan
  • 323
  • 5
  • 19

2 Answers2

0

If you run your application on port 80 then automatically using your domain you can access your application.

Eg. Your IP: 172.26.87.133
    Domain: www.xyz.com
    Port:80
    Now you can access your application by www.xyz.com/index
Ankur Gupta
  • 301
  • 4
  • 12
  • i am using a port 100 – R.Anandan Sep 27 '16 at 04:40
  • For this you need to use reverse proxies, Navigator is your machine Reverse Proxy is nginx running on your machine (127.0.0.1:80) Remote Server is the web site running on your machine (127.0.0.1:100) You can use a lightweight webserver like nginx (even runs on Windows), configure it to reverse proxy test.com to 127.0.0.1:100 and then add the following entry to your HOSTS file: 127.0.0.1 test.com – Ankur Gupta Sep 27 '16 at 05:00
0

Spring is domain agnostic in this case and all configuration are at the tomcat level.
This should work out of the box by default, but as I see that you are using port 100, so I assume that someone already played with the configurations.

Note that if you are using Linux OS using port under 1023 maybe an issue look here.

By default tomcat assign the http connector to all IP addresses associated with the server. As your server ip address already map with domain I would expect it to just work. See How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?

If you are having an issue you should look at your tomcat server.xml file under $CATALINA_BASE/conf

Look for the connector element associated with your port (100) should look similar,if you are using catalina.properties look for bio.http.port.

 <Connector acceptCount="100"
                       connectionTimeout="20000"
                       executor="tomcatThreadPool"
                       maxKeepAliveRequests="15"
                       port="${bio.http.port}"
                       **address="something-here"**  
                       protocol="org.apache.coyote.http11.Http11Protocol"
                       redirectPort="${bio.https.port}"/>

If you find the optional address attribute you can comment it out and it should work (assuming you solved linux configurations issue, if exits).

If you what to be more specific (for example from security reason when you have more then one interface) you can specify the IP or domain name here.

See the tomcat documentation for the address attributre here.

Community
  • 1
  • 1
Haim Raman
  • 11,508
  • 6
  • 44
  • 70