简体   繁体   English

为什么在本地主机后需要端口8080?

[英]why do I need port 8080 after localhost?

I've just downloaded a java application called "test-app" that I obtained from http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html and I setup tomcat 7 in eclipse. 我刚刚下载了从http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html获得的名为“ test-app”的Java应用程序,并在Eclipse中设置了tomcat 7 。 When I started the server I navigated to http://localhost/test-app and got a page could not be found error, but when I went to http://localhost:8080/test-app/ the page came up correctly. 当我启动服务器时,我导航到http://localhost/test-app并找不到页面错误,但是当我转到http://localhost:8080/test-app/ ,页面正确显示。 Why is this occurring? 为什么会这样呢? The tutorial I'm following states that I should be able to navigate to the page without the 8080. 我所遵循的教程指出,我应该能够导航到没有8080的页面。

I believe port 8080 is the default port for tomcat installations. 我相信端口8080是tomcat安装的默认端口。 There should be a file called conf/server.xml which you can change it from 8080 to 80 . 应该有一个名为conf/server.xml的文件,您可以将其从8080更改为80

Look in server.xml for this line: 在server.xml中查找以下行:

 <Connector port="8080" maxHttpHeaderSize="8192"
           maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
           enableLookups="false" redirectPort="8443" acceptCount="100"
           connectionTimeout="20000" disableUploadTimeout="true" />

And change Connector port="8080" to Connector port="80" 并将Connector port="8080"更改为Connector port="80"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM