Reputation: 34424
I have tomcat installed on my local machine. I see it in server.xml where I have below entry
<Connector executor="tomcatThreadPool"
port="${http.port}"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="${https.port}"
acceptCount="100"
maxKeepAliveRequests="15"/>
where http.port value in catalina.properties is 8080 .
But every time I try to access my application it url http://localhost/myApp I get error could not connect to localhost but it works fine http://localhost:8080/myApp. I am not getting why it expects the port 8080 when it is already a default port? What should I do so that I do not have to mention port?
Upvotes: 1
Views: 1569
Reputation: 15876
On a Windows platform all you have to do is changing the port number in server.xml from 8080 to 80 and you are done.
The above is not true for Unix/Linux environments. Changing the port number might work on Windows but i think it might be slightly tricky on Unix/Solaris.
Under UNIX all ports <1024 are "privileged" ports. Only root may open a privileged port. It is still possible but keep in mind that it is not as simple as changing the port number when on Unix.
There are a number of workarounds for this.
http://raibledesigns.com/rd/entry/how_to_run_tomcat_on
http://mihail.stoynov.com/2011/04/04/howto-start-tomcat-on-port-80-without-root-privileges/
http://www.klawitter.de/tomcat80.html
Upvotes: 1
Reputation: 24626
When you write http://localhost/myApp
on the Address Bar of your Browser, the request always goes to Port 80, and not Port 8080. So the default is Port 80 here. For http://localhost/myApp
to work you need to install something like Apache HTTP Server.
Then you can configure it with the help of a connector like mod_jk or mod_proxy to use http://localhost/myAppi
, instead of http://localhost:8080/myApp
. So that what ever request comes on Port 80 can be diverted to Port 8080 automatically.
Once you will download mod_jk, simply extract the file mod_jk.so to the modules folder of your Apache HTTP Server.
Hopefully the steps written here How to Configure Apache HTTP Server with Apache Tomcat, might help you in doing that.
Upvotes: 2