LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 04-02-2009, 09:20 PM   #1
mfoley
Member
 
Registered: Oct 2008
Posts: 67

Rep: Reputation: 15
virtual hosts with apache and tomcat


have been using apache and tomcat on linux for a while now, but only configured as a single domain. Now I want to use multiple virtual hosts. My configuration is not working. It loads the page, but doesn't execute the jsp code which tells me the system is paying attention to the virtual host path, but not the JKmount info. Here's what I have so far:

Linux kernel 2.6.27, slackware
apache 2.2.11
tomcat 6.0.18

httpd.conf
-------------
LoadModule jk_module lib/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile /var/log/httpd/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /examples/* worker1
JkMount /examples worker1
:
<VirtualHost *>
ServerName www.fluxrunner.com
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>

<VirtualHost *>
ServerName www.courtscan.com
DocumentRoot /www/courtscan
<directory /www/courtscan>
allow from all
</directory>
CustomLog /www/courtscan/logs/access_log combined
ErrorLog /www/courtscan/logs/error_log
</VirtualHost>

workers.properties
----------------------
worker.list=worker1,courtscan
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

worker.courtscan.type=ajp13
worker.courtscan.host=localhost
worker.courtscan.domain=courtscan.com
worker.courtscan.port=8009
worker.courtscan.mount=/www/courtscan /www/courtscan/*

server.xml
-------------
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>

<Host name="courtscan.com" appBase="/www/courtscan" >
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs/" prefix="courtscan_access_log" suffix=".log" timestamp="true"/>

<Context path="/" docBase="/www/courtscan" reloadable="false">
<WatchedResource>/WEB-INF/web.xml</WatchedResource>
</Context>
</Host>

I think I'm close ...
 
Old 04-06-2009, 04:06 AM   #2
tizzef
Member
 
Registered: Jan 2005
Location: Nice, France
Distribution: Ubuntu,RHES, Mandriva, RHAS, AIX 4.3.3, 5.2 & 5.3, Debian,Solaris8/10
Posts: 119

Rep: Reputation: 20
Hi,

You should probably use some triks like this :

virtual1.conf :

<VirtualHost 192.168.0.100:80>
DocumentRoot /var/www/virtual1.com
ServerName virtual1.com
</VirtualHost>

virtual2.conf :

<VirtualHost 192.168.0.100:80>
DocumentRoot /var/www/virtual2.com
ServerName virtual2.com
</VirtualHost>


If you have multiple domain name for one @IP.

Have a look here : http://httpd.apache.org/docs/2.0/vhosts/

Cheers
 
Old 04-23-2009, 11:00 AM   #3
mfoley
Member
 
Registered: Oct 2008
Posts: 67

Original Poster
Rep: Reputation: 15
I've returned to this thread because I've run into more problems. My configuration is such that ALL web requests are being routed to tomcat. For example, http://www.courtscan.com is supposed to get jsp docs from /www/tomcat/webapps/courtscan ... which it does. However, http://www.buffalotouch.com is supposed to get html docs from /www/buffalotouch, which it does not. Instead, I get a the default tomcat local home page. I'm sure I have to change something with the server.xml context/document/appBase paths, or perhaps the mount directive in workers.properties, but I'm clueless as to where to start.

Bbelow are the relevant sections of my current httpd.conf, workers.properties and server.xml files:

##### httpd.conf
LoadModule jk_module lib/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile /var/log/httpd/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
##########Virtual hosts section of httpd.conf############
<VirtualHost *>
ServerName www.fluxrunner.com
DocumentRoot /usr/local/apache/htdocs
</VirtualHost>

<VirtualHost *>
ServerName www.courtscan.com
DocumentRoot /www/courtscan
<directory /www/courtscan>
allow from all
</directory>
CustomLog /www/courtscan/logs/access_log combined
ErrorLog /www/courtscan/logs/error_log
</VirtualHost>

<VirtualHost *>
ServerName www.buffalotouch.com
DocumentRoot /www/buffaloTouch
<directory /www/buffaloTouch>
allow from all
</directory>
CustomLog /www/buffaloTouch/logs/access_log combined
ErrorLog /www/buffaloTouch/logs/error_log
</VirtualHost>

#######workers.properties file################
worker.list=courtscan
worker.courtscan.type=ajp13
worker.courtscan.host=localhost
worker.courtscan.port=8009
worker.courtscan.mount=/ /*

####Host tags in server.xml file##########
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>

<Host name="www.courtscan.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>courtscan.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs/" prefix="courtscan_access_log" suffix=".log" timestamp="true"/>

<Context path="" docBase="courtscan" reloadable="false">
<WatchedResource>/WEB-INF/web.xml</WatchedResource>
</Context>
</Host>
 
  


Reply

Tags
apache, host, tomcat, virtual


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 06:29 AM
Tomcat + Apache vhost on different hosts? enigmasoldier Linux - Networking 0 08-17-2005 10:29 AM
Apache Virtual Hosts dienerk Linux - General 15 10-16-2004 12:46 AM
Apache Virtual Hosts quozt Linux - General 3 10-15-2003 09:51 AM
Apache virtual hosts Mil0 Linux - Software 5 06-01-2003 11:58 PM


All times are GMT -5. The time now is 03:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration