On 12/25/2011 03:04 PM, Haru Mamburu wrote:
Hi, All
Recently I had to deploy XWiki under Centos. As a brand new task for me it required tonns
of documentation to dig in.
Finally I managed to set up: Centos + MySQL + Tomcat 7 + nginx.
Everything is fine besides some Tomcat's behaviour.
- localhost:8080 or localhost:8080/ shows ROOT application
- localhost:8080/xwiki shows XWiki application as desired. Fine.
- if nginx redirects required requests from 80 port to localhost:8080/xwiki we obtain
wrong links, because /xwiki automatically is added to requested string. Works fine only
first request to e.g. "mydomain.com".
So, next step is to set XWiki application as DAFAULT application in Tomcat, so
localhost:8080 will call XWiki by default.
Googling gave me several complicated solutions with redirect and two almost clear
solutions with Tomcat configuration:
- Deploy XWiki in $CATALINA_HOME/webapps/ROOT
After this nginx can easily proxy all requests like "mydomain.com" on 80 port
to localhost:8080
- Deploy XWiki in $CATALINA_HOME/webapps/xwiki
Then add Following string in Host section in $CATALINA_HOME/conf/server.xml :
<Context path="" docBase="${catalina.home}/webapps/xwiki"/>
I tried second way, it works fine, nginx redirects all "mydomain.com" requests
to localhost:8080 correctly, BUT all URLs from required, e.g,
localhost:8080/xwiki/bin/view/Main
become
localhost:8080/bin/view/Main
So, we miss /xwiki in URL.
As for me, "xwikiless" URLs solution looks fine, BUT as far as I remember,
somebody from developers' team pointed out in mailing lists some time ago, that /xwiki
in URL could be necessary in some cases. (??)
The questions are:
1. Is it crucial for XWiki and/or some XWiki applications to eat shorten URL on
Tomcat's level?
Will it affect, for example, on virtual wiki mapping for URLs based addresses like
http://myfarm.net/xwiki/wiki/wikiname/?
XWiki should work just fine with the shorter URLs. The "xwikiless"
information might be very outdated, when it used to be true that some
parts of XWiki would fail.
2. Should we change anything in XWiki configuration
files to force it working with such URLs?
No.
OR, the best way to put
${catalina.home}/webapps/ROOT/Web-inf/web.xml with redirect information as it is done e.g.
in standalone XWiki for Windows?
From other side, I also found an opinions on forums, that redirect method is not the
best solution for search engines robots. So, I got lost a bit :-)
Kindly ask you to clarify this tricky subject in order to avoid unnecessary errors in the
future.
On finding right, community approved solution(s), I will amend documentation accordingly.
It should also be possible to configure nginx to work properly with
XWiki deployed as /xwiki/, so if you want, you can dig some more to find
out why it doesn't work right now and what to do to make it work.
My guess is that you're trying to map :80/* to :8080/xwiki/* which means
that /xwiki/ will be added to each URL that nginx requests from Tomcat,
including those that already have /xwiki in them. Thus, all the URLs
generated by XWiki, such as /xwiki/bin/view/Some/Doc, will end up as
:8080/xwiki/xwiki/bin/view/Some/Doc, which is wrong. You should have two
different rules if you want to keep /xwiki/ in the URL:
1. Redirect from
hostname.com/ to
hostname.com/xwiki, as a client
response redirect, not as an internal forwarding.
2. Forward requests to /xwiki/* to :8080/xwiki/*
Thanks in advance,
Dmitry Bakbardin
--
Sergiu Dumitriu
http://purl.org/net/sergiu/