问题
I developed a java web application and generated 2 different enviroment war files names as test.war and prod.war file.
I want to publish the war file in the domain. so i bought the domain. for ex:- www.example.com
and I want to publish my war files in domain as "www.test.example.com" and www.prod.example.com ". Is this possible to do this ?
回答1:
Yes it is possible.
You has bought the last part domain.com
, then you need to configure DNS to point www.test.example.com
and www.prod.example.com
to an IP of a machine owned by you (you can have one machine for each domain).
If you have tomcat then you can deploy two virtual hosts, each one responding to a domain, with its own war deployment
<Engine name="Catalina" defaultHost="www.test.example.com">
<Host name="www.test.example.com" appBase="test"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
<Host name="www.prod.example.com" appBase="prod"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>example.com</Alias>
</Host>
</Engine>
回答2:
Domain is public address which has a public IP.First purchase a platform in which jvm and application container should be available.After that you can configure your deployment descriptor for sub domain
来源:https://stackoverflow.com/questions/41839278/deploy-java-web-application-war-file-in-domain