简体   繁体   English

如何为java spring maven应用程序映射域名?

[英]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.

相关问题 如何使用JDepend来识别Java Spring Maven应用程序中使用的库 - How to use JDepend to identify the libraries used in java spring maven application 使用Java 9和Maven的Spring Boot应用程序编译失败 - compilation failure for spring boot application with java 9 and maven 如何在spring boot 2中使用groovy解释(使用spring-aop注释)2使用maven构建java应用程序? - How to use groovy interpreted (with spring-aop annotation) within an spring boot 2 java application build with maven? spring 引导应用程序如何受 maven 依赖项影响? - How is the spring boot application affected by the maven dependencies? 如何为我的Java应用程序+ mysql创建可安装文件(从maven build spring boot创建的jar) - How to create installable for my java application + mysql (jar created from maven build spring boot) 我们可以在 Java/Spring 应用程序中使用用 Scala 编写的领域模型吗? - Can we use Domain model written in Scala in a Java/Spring Application? 在 Java Spring Maven Web 应用程序中调用 C/C++ 函数 - Call a C/C++ function in Java Spring Maven web application Eclipse + Maven + Spring应用程序:java.lang.NoClassDefFoundError - Eclipse + Maven + Spring Application: java.lang.NoClassDefFoundError 简单的Spring和Maven应用程序-java.lang.NoClassDefFoundError异常 - Simple Spring and Maven Application - java.lang.NoClassDefFoundError Exception 使用 Maven 构建 Spring Boot 应用程序遇到 Java 版本问题 - Spring Boot application build with Maven encounters Java Version Issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM