El 26-05-10 18:31, Borut Hadžialić escribió:
Hi Patricio, try this:
1. Redeploy your app in tomcat so it shows at http://mydomain:8080/
instead of http://mydomain:8080/myapp
How you do this depends on how you deployed the app in the first place -
a) if you deployed a myapp.war and use autodeploy, then rename it to
ROOT.war and redeploy it
b) if you are using a <Context element, set its path attribute to ""
2. Add an AJP connector to your tomcat's conf/server.xml eg:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
URIEncoding="utf8"/>
and restart tomcat
3. Define an apache mod_jk worker eg:
/usr/local/apache2/conf/workers.properties:
worker.list=myapp
worker.myapp.type=ajp13
worker.myapp.host=localhost
worker.myapp.port=8109
4. Add a virtual host in apache configuration:
NameVirtualHost *:80
....
<VirtualHost *:80>
ServerAdmin y...@gmail.com <mailto:y...@gmail.com>
DocumentRoot "/usr/local/apache2/htdocs" <--- this is irrelevant
because of JkMount /*
ServerName www.mydomain.com <http://www.mydomain.com>
# ServerAlias www.somethingelse.com <http://www.somethingelse.com>
ErrorLog "logs/www.mydomain.com-error_log"
CustomLog "logs/www.mydomain.com-access_log" common#
JkMount /* myapp
</VirtualHost>
5. Make sure mod_jk config is in apache conf:
<IfModule jk_module>
JkWorkersFile /usr/local/apache2/conf/workers.properties
JkShmFile /usr/local/apache2/logs/mod_jk.shm
JkLogFile /usr/local/apache2/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
</IfModule>
Restart apache.
In that case files in /home/mydomain/htdocs are no longer relevant.
On Wed, May 26, 2010 at 11:32 PM, Bithost Ltda.
<bithost.ch...@gmail.com <mailto:bithost.ch...@gmail.com>> wrote:
Hello
I'm new to tomcat and i have some experience with apache, i have a
debian server with apache 2.2 + mod_jk and tomcat 6 server.
My doc root for my site is /home/mydomain/htdocs and i have a site
which is using a WAR which i deployed it via the tomcat manager.
So far if i go to http://mydomain:8080/myapp it shows fine, but
now what i need is that if i type www.mydomain.com
<http://www.mydomain.com> it has to show the app directly. I've
managed to create an htaccess with a 301 redirect to the url
http://mydomain:8080/myapp as a temporal fix, but what i need is
that when i type www.mydomain.com <http://www.mydomain.com> it
goes to my app and stays with the mydomain.com
<http://mydomain.com> url.
How can i do that? do you need any config file? any help is
appreciated.
Thanks in advance.
--
Patricio López Salgado
Jefe de Operaciones
2-697 9216
<http://www.bithost.cl>
--
Why?
Because YES!
Hello
I appreciate this very helpful guide, i have some of these configs
already in motion (got the ajp connector port, workers.properties and
mod_jk included in apache), but what if i have more than 2 sites which
need the same way of deploy (virtualhosting), in that case i can't
deploy it under mydomain.com:8080, it has to be under
mydomain.com:8080/myapp
Thanks for your time.