You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/02/02 01:03:52 UTC

apache + tomcat virtual hostnames

I am using apache 2 and tomcat 4.1 connected
with mod_jk. I have multiple virtual named
hosts in the httpd.conf file, such as:

<VirtualHost *:80>
   ServerName www.myserver.com
   ServerAlias myserver.com
   ...

set up so that apache serves up the static
content, and tomcat will handle the servlet
stuff. In my server.xml file I set the attribute
"name" to "www.myserver.com" in the Host tagset.
This works fine if I hit http://www.myserver.com
but not for http://myserver.com. Apache handles
both the same, but not tomcat. Is there something
like ServerAlias in tomcat?

Dean


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: apache + tomcat virtual hostnames

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
OK, I am answering my own question here...

The trick is to set:

UseCanonicalName on

in httpd.conf

Dean A. Hoover wrote:

> I am using apache 2 and tomcat 4.1 connected
> with mod_jk. I have multiple virtual named
> hosts in the httpd.conf file, such as:
>
> <VirtualHost *:80>
>   ServerName www.myserver.com
>   ServerAlias myserver.com
>   ...
>
> set up so that apache serves up the static
> content, and tomcat will handle the servlet
> stuff. In my server.xml file I set the attribute
> "name" to "www.myserver.com" in the Host tagset.
> This works fine if I hit http://www.myserver.com
> but not for http://myserver.com. Apache handles
> both the same, but not tomcat. Is there something
> like ServerAlias in tomcat?
>
> Dean
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Updated WebApp Tutorial

Posted by Oscar Carrillo <to...@daydream.stanford.edu>.
Hi,

Some of you may know my site:

HOWTO: Installing Web Services with
  Linux / Tomcat / Apache / Struts / Postgresql / Openssl / JDBC

I've worked on it a lot and have added many features, including

-JDBC/JNDI configuration w/DBCP-commons Pool

-build scripts for everything
-all the configuration files
-Virtual Host configuration
-A Struts-based Database Test Web App

I am having to move the site, and am now hosting this site here:
http://www.linuxjava.net/howto/webapp/

I'm including my README file for people's perusal. Please visit the site
for more info.


README
------------------------------------------------------------------------------
These files can all be downloaded with the one link:
-webapp_files.tar

I recommend doing things in this order.

Install Java
-java_install.sh

Install Ant
-ant_install.sh

Install OpenSSL. It needs to be installed before Apache.
-openssl_install.sh

Install Apache. Pretty straight-forward. Builds a few modules, not all or 
most, just fairly common ones. Add
 more modules if you want them built here.
-http_install.sh

Install Tomcat4
-tomcat_setup_user.sh
-tomcat4_install.sh

Install Mod_JK
-modjk_install.sh

Install Postgres
Read these install script. It needs to remove the bison RPM first, but it 
is commented out, cause I don't wa
nt someone to do something to their system that they don't intend. Install 
in the listed order.
-bison_install.sh
-postgres_setup_user.sh
-postgres_install.sh

Install PgAccess
-pgaccess_install.sh
-pgaccess #Put this in "/usr/local/bin/" for easy access

Sample Database
#Import the testdb.psql into your Postgres DB. This is for the Test DB 
Struts Web App.
-testdb.psql

Configuration Scripts:
Apache
-httpd.conf
-ssl.conf

Tomcat
-workers.properties
-server.xml

Daemon Scripts for Apache, Tomcat, and Postgres
-httpd
-tomcatd
-postgresqld

Struts Web App
#Extract and put in /usr/local/tomcat/webapps
-strutsdb_webapp.tar.bz2

Once everything is running, you should be able to test the webapp by going to:
http://www.myhost.mydomain/mydomain_public/

It will also be available here:
http://www.myhost.mydomain:8080/mydomain_public/

There is also a JSP file called "showJNDI.jsp" that will give you some
info about your setup. Delete that file for anything in production as it
will display your database configuration.
--------------------------------------------------------------------------

Please visit the site and any feedback is appreciated.

Regards,

Oscar Carrillo
http://www.linuxjava.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org