I am using Tomcat8. I deployed a war file by name admin.war.This resulted in my URL turning out to
http://localhost:8080/admin.
Nevertheless, I want the URL to be http://localhost:8080. So I tried adding the following inside /conf/server.xml as mentioned here.
< Context path="" docBase="Advocatoree" debug="0" reloadable="true" >
However, this did not work. Is there an alternative?
Try to add a file called ROOT.xml in <catalina_home>/conf/Catalina/localhost/
And enter there the following:
<Context
docBase="yourAppName"
path=""
reloadable="true"
/>
Now your application is default application on your server and you can access it with URL http://localhost:8080
Related
I have a web-site that I have deployed locally on IIS/ColdFusion but Tomcat/Lucee in production (the production server is Windows Server). Tomcat is not running as a Windows Service
I am trying to set up virtual directories since IIS and Tomcat seem to handle relative paths differently. I have a virtual directory called "/style" set in IIS that points to my style sheet directory which works just fine. When I try to modify the server.xml file in Tomcat8, it never works.
I am using the following tag in my cfm header file:
<link rel="Stylesheet" media="screen" href="/style/styles.css">
Here is a portion of my server.xml file:
<Host name="127.0.0.1" appBase="webapps" unpackWARs="true" autoDeploy="true">
<context path="/style" docBase="C:\lucee\tomcat\webapps\ROOT\mysite\_style" ></context>
I have tried moving the context to different locations within the server.xml file, I have tried different context attributes. Nothing seems to work.
Any suggestions?
I used the information from the following link:
https://www.petefreitag.com/item/867.cfm
and used the following:
<Context path=""
docBase="C:\lucee\tomcat\webapps\ROOT"
WorkDir="C:\lucee\tomcat\temp">
<Resources>
<PreResources base="C:\lucee\tomcat\webapps\ROOT\mysite\_style"
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/mysite/style"/>
</Resources>
</Context>
The access to my server should be limited to some Remote hosts, and I want to allow Uptimerobot to monitor my server.
Currently uptimerobot gets always a 403 Forbidden.
I added Server.xml looks like this:
<Server .........>
<Service name="Catalina">
<Engine>
<Value className="org.apache.catalina.valves.RemoteHostValve" allow=".*\.uptimerobot\.com" />
</Engine>
</Service>
To match all hosts in this list UptimeRobot Whitelist
But after restarting server nothing changed, still 403.
I also tried to use a domain-name without wildcards like this:
allow="engine19\.uptimerobot\.com"
allow="engine19.uptimerobot.com"
But still 403,
I tried to enable hostnamelookups with adding
enableLookups="true"
to the <Connector
tag, but again no effect.
But in my logs I see that the access is resolved to "engine19.uptimerobot.com" wich matches my RemoteHost-Pattern.
Any Ideas, why it is still forbidden ?
EDIT:
Access via IP with
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="63\.143\.42\.244"/>
is working. But I dont want to add the whole list of ips there.
Is it possible that RemoteAddrValve and RemoteHostValve are disturbing eachother ?
I have tried this and this worked for me
set useIPVHosts to true in connector (Inside server.xml).
I am using HTTP connector and it looks as follow
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
enableLookups="true"
useIPVHosts="true" />
Details of attributes can be found here
Check tomcat/logs/local_access_log... to see what host name used for 403.
I found that our company DNS reports some names in all uppercase and others in all lowercase. Use (?i) to have regex be case insensitive:
allow="(?i)engine19\.uptimerobot\.com"
If you have both RemoteHostValve and RemoteAddValve, both must allow an incoming host. If either does not allow then 403 will be returned.
I have apache tomcat running into a specific server and I've deployed a project named where2go. So I have a file named:
where2go.war and I deployed this one.
Right now when I try to access this link:
where2go.ca is going to no where and you get a blank page.
If I want to access the project I need to go to:
where2go.ca/where2go
How do I configure my server to show where2go project when I access where2go.ca?
If I understand right your question, you want to put your project on the root of the server and call it like the following: where2go.ca/ instead of where2go.ca/where2go/
If so, in order to achieve that, you need to modify your server.xml (you can find it in the tomcat configuration folder.
Open the server.xml file using your favorite text editor, and add the following directive the file, before the </Engine> directive
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="where2go" reloadable="true" override="true"></Context>
</Host>
The above will change your server root path to your project folder.
This change is good when you don't have other project deployed on the same server.
Another solution (to my opinion less preferable) is to manually deploy your project into the ROOT folder inside your /webapps folder.
Hope it will help,
Liron
After looking a while I found the solution on this link:
How can I remove the application name from a Grails application’s URL?
I used the first method:
first shutdown your tomcat [from the bin directory (sh shutdown.sh)] then you must delete all the content of your tomcat webapps folder (rm -fr *) then rename your WAR file to ROOT.war finally start your tomcat [from the bin directory (sh startup.sh)]
I have have a domain name (for example myapp.com) that I am using it to redirect to a web application (for exmple "myapp"), which is deployed on my tomcat server (for example in "myserver.es/myapp"). I added this fragment to the server.xml file of the tomcat to configure the redirection:
<Host name="myapp.com" appBase="webapps/myapp"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/" docBase="."/>
<Alias>www.myapp.com</Alias>
</Host>
Apparently it is working good, if I write "mydomain.com" in the browser the app is shown correctly.
The problem: when I generate a new WAR file of that app and I upload it to the Tomcat server (after stopping and undeploying the previous version), the changes related with Java code are not shown. I have to restart my tomcat server to access to the last version of the app from "myapp.com".
In contrast, if I access to "mydomain.com/myapp", I can see the last version of the app, showing the changes made in the last WAR.
So, I think that the problem is related with the redirection. It is anything wrong with the previous XML code?
The other "Host" configured in the server.xml is this one:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
You might be having issues with Parallel Deployement
You could set undeployOldVersions="true" inside your host to see if that works.
Finally, I've discovered the solution! I needed to set privileged="true" inside the Context tag.
I'd like run jsp files directly from /srv/http without deploying them the Tomcat-way. For example, I want to be able to create symbolic link to my webapp directory (e.g. /home/user/myapp/) in /srv/http and access some app's page through http://localhost/myapp/page.jsp.
Is this possible and how would I set this up?
NOTE: This is not for production. We have to use JSP at university and I want to be able to quickly test my pages.
Open the server.xml of your Tomcat. Assuming if your are using Tomcat 6.x+ then it would be at /tomcatDir/conf/server.xml.
Make an entry with your path
<Context path="/myapp" docBase="yourPathGoesHere" debug="0" reloadable="true" />
Restart Tomcat if already running.
What I did at the moment was creating a symlink in /var/lib/tomcatX/webapps to my project path. This is not the answer I was looking for though, but it is a way to deploy an app without much work.
(X in the above path means your Tomcat version)
If you set <Host name="localhost" appBase="/srv/http"> then all of the directories in it will be deployed as web applications.
If you want /srv/http to be the ROOT application/directory add a file: tomcat/conf/Catalina/localhost/ROOT.xml
with the Context docBase="/srv/http", rather than adding a Context definition to server.xml - this has been strongly discouraged for years.