Tomcat won't point to new port after changing in server.xml - tomcat8

Changed the port from 8080 to 9090. But still it pointing to 8080
<Connector port="9090" address="0.0.0.0" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443">
</Connector>
Browser

Found my problem. I was referring to wrong folder("C:\tomcat-8.5.24\conf") instead of "C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf"
OpenKM installed Tomcat in "C:\tomcat-8.5.24". So when I tried to access http:localhost:8080/OpenKM, it was saying someone is already using port 8080.
So I was making changes to "C:\tomcat-8.5.24\conf\server.xml" and restarting Tomcat service instead of OpenKM service.

Related

Can't sign in to the Apache Tomcat Version 8.5.75

I have previously installed some older Apache Tomcat. I have already removed they completely(how to remove it) and reinstall the Apache Tomcat 8.5 . Now when I try to type http://localhost:8080/ and try to log in , It doesn't give me to login even I give the correct username and password.
this is my 'tomcat-users.xml'
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<user username="admin" password="admin" roles="manager-gui" />
LogIn image help me to fix it
I changed port number from 8080 t0 8081 and it worked. Go to apache tomcat installation directory and find conf directory in my pc it is
C:\Program Files\Apache Software Foundation\Tomcat 10.0\conf
Now open the server.xml and change the port number to 8081 and save.
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Now restart the apache tomcat server.

Apache Tomcat Listen Multiple Ports

I have a Windows based Apache Tomcat installation. The application is currently listening on port 8080. I would like to create a redirect from the root of port 80 to the site being hosted in a sub directory on 8080.
Instead of entering the long URL to access the site (http://servername:8080/subdirectory/index.jsp) I would like to just enter (http://servername) and have this redirect to the sub-directory on port 8080.
I tired adding this to the server.xml without luck.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
I added this:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"/>
I also modified the index.jsp in the root directory to:
<% response.sendRedirect("server:8080/subdir/login.jsp"); %>
I still don't believe the site is listening on 80 and when visiting the root site "http://sitename:8080" I it's not redirecting. Any help would be appreciated. I am somewhat familiar with Apache but not with Tomcat.
I got this to work by adding the following to server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8080" />
I also added this to index.jsp within the root folder:
<% response.sendRedirect("http://servername:8080/subdir/page.jsp"); %>
Does this seem like an OK way to handle what I am trying to accomplish? I don't mind if users see the redirected URL.
I don't see the point of most of this. Just change the existing single connector from port 8080 to port 80 and forget about port 8080 altogether. No redirection, no dual connectors, no nothing. Or if you must have both ports just use two Connectors. There's no apparent reason to use the redirect JSP to force the port change, just redirect to the sub page.

Limiting Tomcat http connector to Apache server

I am using Apache 2.4 in front of Tomcat 7. I am trying to use web-sockets so I have configured http based connector in tomcat as below
<Connector port="8009"
protocol="HTTP/1.1"
proxyPort="80"
maxPostSize="10485760"
redirectPort="8443"
URIEncoding="UTF-8"/>
I have configured mod_proxy and mod_proxy_wstunnel and mod_proxy_http in Apache 2.4 Web-socket connections works fine when accessed App via "http://webserver/myapp".
However app can also be accessed via http://webserver:8009/myapp.
I want my app to be accessible only via Apache webserver (http://webserver/myapp) and NOT directly using tomcat(http://webserver:8009/myapp). I cannot use AJP modules (mod_proxy_ajp or mod_jk) because AJP modules doesn't support web-sockets.
Is there a way I can limit tomcat Connector to Apache webserver only.
You can use this.
<Context path="/manager" docBase="manager" reloadable="true" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteIpValve"/>
<Valve className="org.apache.catalina.valves.RemoteHostValve" allow="<your IP regex>"/>
</Context>
Change appropriate valve in Context Path, docbase and IP Address. This would at least restrict to localhost.
Other way is to listen tomcat only on localhost with help of below code.
<Connector port="8009" address="127.0.0.1"
Use a firewall on your server. This way you not only make tomcat unavailable, but also any other process that happens to open a port on that machine.
Whitelist the ports that you want to be available to the world and default to blocking every other port.

(Tomcat Apache configurations)can't see Tomcat Apache landing page

Actually, I'm new to Linux and its configurations. I just installed Tomcat Apache 7.0.52 on my debian linux. I entered IP192.168.56.10, the server ip, but it shows it works! page which means the older version of apache server:Apache/2.2.16 (Debian) is running, not tomcat, the correct page should contain tomcat's logo. Is there any configurations I missed?
Check the server.xml. Tomcat's port is normally 8080, if you have not changed it. So please try the IP with the port: 192.168.56.10:8080
This defines the port, where the server listens:
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

DNS Management for Tomcat server

I have a tomcat server running perfectly at http://68.169.56.63:8080 I have a subdomain http://solar.wbe.in. Now I want my website http://solar.wbe.in to point to that tomcat server so that if I open http://solar.wbe.in site my browser it should show http://68.169.56.63:8080 I was looking at A records in DNS management. It has option to map IP but not port number. How do I map port 80 of http://solar.wbe.in to port 8080 of http://68.169.56.63
You could change the port in the Tomcat Server.xml e.g
<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Or you could install a webserver like apache to listen on port 80 and proxy the requests through to Tomact either use mod_jk or mod_proxy.