I have two apps which I am trying to proxy through Apache. How do I set up the servers.conf if I have two apps I need to proxy?
I'm using Apache 2.0.52 and httpd.conf looks like: <VirtualHost *:80> ServerName app1.mydomain.com ProxyPass / http://localhost:8082/app1/ ProxyPassReverse / http://localhost:8082/app1/ </VirtualHost> <VirtualHost *:80> ServerName app2.mydomain.com ProxyPass / http://localhost:8082/app2/ ProxyPassReverse / http://localhost:8082/app2/ </VirtualHost> I'm using Tomcat 5.5 and server.xml looks like this: <Server port="8005" shutdown="SHUTDOWN"> <!-- Comment these entries out to disable JMX MBeans support used for the administration web application --> <Listener className="org.apache.catalina.core.AprLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> <!-- Global JNDI resources --> <GlobalNamingResources> <!-- Test entry for demonstration purposes --> <Environment name="simpleValue" type="java.lang.Integer" value="30"/> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- Define the Tomcat Stand-Alone Service --> <Service name="Catalina"> <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> <!-- Note : To disable connection timeouts, set connectionTimeout value to 0 --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> <!-- Define a Proxied HTTP/1.1 Connector on port 8082 --> <!-- See proxy documentation for more information about using this. --> <Connector port="8082" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" acceptCount="100" connectionTimeout="20000" proxyPort="80" disableUploadTimeout="true" /> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1"> --> <!-- Define the top level container in our container hierarchy --> <Engine name="Catalina" defaultHost="localhost"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <!-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. --> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> </Engine> </Service> </Server> Peter Stavrinides wrote: > > It is just the port your Tomcat is running on, which could be any port, > so if you are using 8082 that will be your port... it's better though > not to be on port 80. > > > mip wrote: >> Thanks Peter. >> >> Should that be: >> >> -------------- >> servers.conf >> -------------- >> T1 tomcat.server.com:8082 >> ALL tomcat.server.com:8082 >> >> ? >> >> If not what is port 8081 being used for? >> >> >> >> Peter Stavrinides wrote: >> >>> Thats because your configuration is incomplete, in order for Apache to >>> pass the cookie to the correct context you need to do some additional >>> configuration (or alternatively use a connector like mod_jk) >>> >>> You may need to configure the jvmRoute parameter in server.xml, this >>> allows Apache to map to the correct Tomcat context, otherwise deploy >>> your web app in the Tomcat root context. >>> >>> <Connector port="8082" >>> maxThreads="150" minSpareThreads="25" >>> maxSpareThreads="75" >>> enableLookups="false" >>> acceptCount="100" debug="0" connectionTimeout="20000" >>> proxyPort="80" disableUploadTimeout="true" >>> jvmRoute=T1/> >>> >>> >>> You also need to add a server mapping in Apache, one way to do this >>> easily is with a RewriteMap. (If you use Apache 2.2 then you could use >>> the in-built mod_proxy_balancer module). I also use Apache 2.0 so I just >>> make a static mapping, which looks something like this: >>> >>> >>> RewriteMap SERVERS rnd:/etc/apache2/servers.conf >>> >>> -------------- >>> servers.conf >>> -------------- >>> T1 tomcat.server.com:8081 >>> ALL tomcat.server.com:8081 >>> >>> >>> #configure more instances for load balancing if you wish >>> >>> Peter >>> >>> >>> >>> mip wrote: >>> >>>> I'm trying to proxy my Tomcat web application through Apache 2.0 using >>>> mod_proxy. >>>> >>>> I have uncommented the following in my server.xml: >>>> >>>> <!-- Define a Proxied HTTP/1.1 Connector on port 8082 --> >>>> <!-- See proxy documentation for more information about using this. >>>> --> >>>> <Connector port="8082" >>>> maxThreads="150" minSpareThreads="25" >>>> maxSpareThreads="75" >>>> enableLookups="false" >>>> acceptCount="100" debug="0" connectionTimeout="20000" >>>> proxyPort="80" disableUploadTimeout="true" /> >>>> >>>> and I've added the following to my httpd.conf: >>>> >>>> <VirtualHost *:80> >>>> ServerName foo.bar.com >>>> ProxyPass / http://foobar.com:8082/app/ >>>> ProxyPassReverse / http://foobar.com:8082/app/ >>>> </VirtualHost> >>>> >>>> The pages are being passed without any problems but the sessions are >>>> being >>>> lost as cookies are not being passed. I'm guessing I need to add >>>> something >>>> to the above stanza which rewrite the cookies. But what? >>>> >>>> >>> >>> >> >> > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tomcat-5.5%2C-Apache-2.0.XX-and-mod_proxy-tf4881521.html#a13972723 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]