2012-11-23 49 views
3

我想爲Tomcat 6.0設置一個DNS名稱。我通過編輯Tomcat 6.0中的server.xml文件來嘗試它。我的要求是一個有效的域名,而不是本地主機。通常,http://localhost:8080用於訪問tomcat管理器頁面。我試圖改變它,但我不能。請幫我設置一個域名。tomcat的域名

回答

4

如果tomcat的主機沒有公共域名,則應該編輯主機文件。如果您的操作系統是unix系列(即Linux,MacOSX等),您可以在/etc/hosts中看到主機文件。 您可以添加以下行:

127.0.0.1 your.host.name 

如果你的操作系統是Windows,你可以找到你的主機在

C:\Windows\System32\drivers\etc\hosts 

文件編輯後的hosts文件,重新啓動Tomcat。然後,您可以在瀏覽器的地址欄中輸入http://your.host.name:8080來訪問您的tomcat。

+0

非常感謝您的幫助.....成功完成。 –

2
step1>open notepad as administrator 
step2>in notepad open C:\Windows\System32\drivers\etc and select hosts file. 
step3>replace # 127.0.0.1 localhost to 127.0.0.1 www.yourdomain.com and save the file. 
note: not click on save as. don't forget to remove # 
step4>add your application to webapp folder 
step5>open tomcat and search server.xml and open it. and then change http port no to 80 
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> 

step6>under <Engine> tag add the following 
<Host name="www.yourdomain.com" appBase="webapps" 
     unpackWARs="true" autoDeploy="true"> 
     <Context path="" docBase="your project name"/> 
     </Host> 
adn save the file. 
note: Make Sure that you have welcome file config.. in web.xml 

step7>now restart tomcat server 
step8>open browser and type www.yourdomain.com 
...........................................................