There are two parts to understand here
1- Apache frontend static content serving server
2- Tomcat for dynamic request processing like jps,jsf,grails,spring framework
We need to configure two things here.
Lets assume that you have apache running on your maching and you just want to configure it for tomcat connectivity .
Find httpd.conf and configure the below settings and change the mydomain1 and mydomain2 by your actual domain . please make you have the right path for example - /var/log/apach2/error-domain1.log , if you have other path , than configure that one.
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="250" minSpareThreads="40"/>
<Connector port="8083" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444"
executor="tomcatThreadPool"
proxyName="www.mydomain1.com"
proxyPort="80"/>
<Connector port="8084" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8445"
executor="tomcatThreadPool"
proxyName="www.mydomain2.com"
proxyPort="80"/>
<Host name="www.mydomain1.com" appBase="vhosts/mydomain1" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>mydomain1.com</Alias>
</Host>
<Host name="www.mydomain2.com" appBase="vhosts/mydomain2" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>mydomain2.com</Alias>
</Host>
1- Apache frontend static content serving server
2- Tomcat for dynamic request processing like jps,jsf,grails,spring framework
We need to configure two things here.
Lets assume that you have apache running on your maching and you just want to configure it for tomcat connectivity .
Find httpd.conf and configure the below settings and change the mydomain1 and mydomain2 by your actual domain . please make you have the right path for example - /var/log/apach2/error-domain1.log , if you have other path , than configure that one.
ProxyRequests Off
ErrorLog /var/log/apache2/error-domain1.log
<Directory proxy:http://www.mydomain1.com:80>
Order Allow,Deny
Allow from all
</Directory>
<Proxy www.mydomain1.com:80>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
ProxyPreserveHost On
</VirtualHost>
<VirtualHost *:80>
ServerName www.mydomain2.com
ServerAlias www.mydomain2.com
ProxyRequests Off
ErrorLog /var/log/apache/error-domain2.log
<Directory proxy:http://www.mydomain12.com:80>
Order Allow,Deny
Allow from all
</Directory>
<Proxy www.mydomain2.com:80>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8084/
ProxyPassReverse / http://localhost:8084/
ProxyPreserveHost On
</VirtualHost>
Configure the server.xml in Tomcat . Add these values or if they are there ,just configure them.
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="250" minSpareThreads="40"/>
<Connector port="8083" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8444"
executor="tomcatThreadPool"
proxyName="www.mydomain1.com"
proxyPort="80"/>
<Connector port="8084" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8445"
executor="tomcatThreadPool"
proxyName="www.mydomain2.com"
proxyPort="80"/>
<Host name="www.mydomain1.com" appBase="vhosts/mydomain1" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>mydomain1.com</Alias>
</Host>
<Host name="www.mydomain2.com" appBase="vhosts/mydomain2" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Alias>mydomain2.com</Alias>
</Host>
No comments:
Post a Comment