Reputation: 11
I am facing issues in configuring virtual hosts in tomcat 7.
Till now, I have done the following:
Added a Host element in the server.xml file with the appBase as the webapp folder that has my web application.
<Host name="www.*myhostname*.com" appBase="my_webapp_folder_name" unpackWARs="true" autoDeploy="true">
<Context docBase="path_of_external_folder" path="/img" />
</Host>
Changed the defaultHost in the Catalina Engine.
<Engine name="Catalina" defaultHost="www.*myhostname*.com">
Created a webapp folder (my_webapp_folder_name) in catalina.home. Also created a ROOT folder inside this webapp folder.
Copied all the JSPs/HTML, class files, CSS etc inside this ROOT folder.
Created a file ROOT.xml inside the catalina.home/conf/Catalina/myhostname folder with the following contents:
<Context path="" docBase="${catalina.home}/my_webapp_folder_name/ROOT" />
Am I missing something here? Because, after doing all the above, I am unable to connect using the host name. But if I type in the IP address of the server, it works fine.
I cannot say whether there is any permissions related issue or not.
Please help me in resolving this issue.
Upvotes: 1
Views: 3693
Reputation: 121
It must be a matter of name resolution. You must be able to resolve the www.myhostname.com.
You can add a name record if it is only to develop on your computer:
On Windows:
C:\Windows\System32\drivers\etc\hosts
On Linux:
/etc/hosts
You can check the resolution with nslookup or dig.
Otherwise, set up your DNS to resolve www.myhostname.com to your Tomcat bind address.
Upvotes: 1