tomcat的域名

Vin*_*kar 4 dns tomcat

我想为Tomcat 6.0设置DNS名称.我通过编辑Tomcat 6.0中的server.xml文件来尝试它.我的要求是有效的域名,而不是localhost.通常,http://localhost:8080用于访问tomcat管理器页面.我试图改变它,但我不能.请帮我设置一个域名.

nta*_*lbs 10

如果tomcat的主机没有公共域名,则应编辑主机文件.如果您的操作系统是unix-family(即Linux,MacOSX等),您可以在其中看到主机文件/etc/hosts.您可以添加以下行:

127.0.0.1 your.host.name
Run Code Online (Sandbox Code Playgroud)

如果您的操作系统是Windows,则可以在其中找到您的主机文件

C:\Windows\System32\drivers\etc\hosts
Run Code Online (Sandbox Code Playgroud)

编辑hosts文件后,重启tomcat.然后,您可以通过输入http://your.host.name:8080浏览器的地址字段来访问您的tomcat .


sud*_*was 5

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
...........................................................
Run Code Online (Sandbox Code Playgroud)