首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tomcat的域名

tomcat的域名
EN

Stack Overflow用户
提问于 2012-11-23 18:11:58
回答 2查看 32.1K关注 0票数 5

我想为Tomcat 6.0设置一个DNS名称。我尝试过在Tomcat6.0中编辑server.xml文件。我的要求是一个有效的域名,而不是本地主机。通常,http://localhost:8080用于访问tomcat管理器页面。我试着改了,但是改不了。请帮我设置一个域名。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-11-23 18:16:48

如果tomcat的host没有公有域名,则需要编辑host文件。如果你的操作系统是unix系列的(例如Linux、MacOSX等),你可以在/etc/hosts中看到主机文件。您可以添加以下行:

代码语言:javascript
复制
127.0.0.1 your.host.name

如果您的操作系统是windows,您可以在以下位置找到hosts文件

代码语言:javascript
复制
C:\Windows\System32\drivers\etc\hosts

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

票数 13
EN

Stack Overflow用户

发布于 2014-11-13 02:48:25

代码语言:javascript
复制
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
...........................................................
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13526903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档