Can't sign in to the Apache Tomcat Version 8.5.75 - authentication

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.

Related

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

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.

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.

After using mod_proxy the web application is no more accessible from other computer

I used apache proxy support in tomcat to remove the port number from url. Here is what I did,
In http.conf file I added
LoadModule proxy_module mod_proxy.so
ProxyPass /alfresco http://localhost:8080/alfresco
ProxyPassReverse /alfresco http://localhost:8080/alfresco
In server.xml file of tomcat
<Connector port="8080" ...
proxyPort="80"/> (I didn't give proxy name)
Now I am able to access the web application using http:\\localhost/alfresco in my machine. But when I try this from other machine in my lan using http:\\machine1\alfresco I am getting page cannot be displayed error. But if I try http:\\machine1 I am getting It works page of apache. What went wrong?
Previously I am able to use the application from other machine.
I removed the proxy port="80" in server.xml file and now its working

(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" />

Configuration to get the images from the apache

I have multiple Tomcat servers. In each tomcat I am loading all images. I want to move the images from Tomcat to Apache and access the images from there.
My question is: is there any configuration to get the images in a Java web application from Apache instead of Tomcat?
I don't think so - images are shown by resolving their URL, and in most cases it is relative to the current page.
But you can use mod_proxy (or mod_jk) to use all your tomcats through Apache.
Hide your tomcat servers behind an apache server and then you can do something like this:
<VirtualHost www.example.com:80>
ServerName www.example.com
DocumentRoot /var/www/html
ProxyPass /img !
ProxyPass / ajp://localhost:1234/
</VirtualHost>
Apache will serve /img from /var/www/html/img and other requests will be sent to tomcat. This configuration needs mod_proxy_ajp apache module to be active. Tomcat must listen to AJP requests on the given port, use:
<Connector port="1234" protocol="AJP/1.3" redirectPort="8443" address="127.0.0.1" URIEncoding="UTF-8" />
And configure tomcat to serve www.example.com or the default virtual host.
<Host
name="www.example.com"
appBase="/path/to/tomcat/apps/www.example.com"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false"
/>
or
<Host
name="localhost"
appBase="/path/to/tomcat/apps/www.example.com"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false"
/>
Deploy your webapp to /path/to/tomcat/apps/www.example.com/ as ROOT.war, this should be enough to have the whole setup up and running.