[英]How to map domain for java spring maven application?
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. 我已经在tomcat 7服务器.tomcat 7服务器上托管了我的spring应用程序,它安装在我们自己的server.our服务器ip地址已经映射到domain.for现在如何为我的spring应用程序映射域。 for now i am accessing url like http:ipaddress:100/appname
现在我正在访问URL如http:ipaddress:100 / appname
If you run your application on port 80 then automatically using your domain you can access your application. 如果您在端口80上运行应用程序,然后自动使用您的域,则可以访问您的应用程序。
Eg. Your IP: 172.26.87.133
Domain: www.xyz.com
Port:80
Now you can access your application by www.xyz.com/index
Spring is domain agnostic in this case and all configuration are at the tomcat level. 在这种情况下,Spring与域无关,并且所有配置都处于tomcat级别。
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. 默认情况下,这应该是开箱即用的,但是当我看到你使用端口100时,所以我假设有人已经使用了配置。
Note that if you are using Linux OS using port under 1023 maybe an issue look here . 请注意,如果你是1023下使用端口使用Linux操作系统,也许问题看这里 。
By default tomcat assign the http connector to all IP addresses associated with the server. 默认情况下,tomcat将http连接器分配给与服务器关联的所有IP地址。 As your server ip address already map with domain I would expect it to just work.
由于您的服务器IP地址已经与域映射,我希望它能正常工作。 See How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
请参阅如何配置tomcat绑定到单个IP地址(localhost)而不是所有地址?
If you are having an issue you should look at your tomcat server.xml file under $CATALINA_BASE/conf 如果您遇到问题,请查看$ CATALINA_BASE / conf下的tomcat server.xml文件
Look for the connector element associated with your port (100) should look similar,if you are using catalina.properties look for bio.http.port. 查找与您的端口(100)关联的连接器元素应该看起来类似,如果您使用catalina.properties查找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). 如果你找到可选的地址属性,你可以将它注释掉它应该有效(假设你解决了Linux配置问题,如果退出)。
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. 如果您更具体(例如,当您有多个接口时出于安全原因),您可以在此处指定IP或域名。
See the tomcat documentation for the address attributre here . 请在此处查看tomcat文档以获取地址attributre。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.