I run some application at linux server. It's quite simple installation but sometimes it's difficult for me to remember why it's configure in such way. This post helps me to understand current state. Hopefully it will be useful for someone else.
Server is just one linux box with CentOS. There are no dependencies to other nodes or services. It's really simple.
On server is installed Apache HTTPD service. Service could be started stopped via commands
/etc/init.d/https {stop|start| ...}
. Among others apache contains module mod_jk which is responsible for communication with AJP protocol load balancing and other stuff. Closer description of mod_jk could be found at http://tomcat.apache.org/connectors-doc/. The reason why I need Apache HTTPS in front of Tomcat server is that I need more tomcats for different hosted domains and Apache HTTPD server is used also for PHP. Connection between Apache HTTPD server and Tomcat servers is at following image.
Applications are also split between few linux system accounts. It's because of security.
Now let's look at configuration of Apache HTTPD:
<VirtualHost *:80> ServerName www.domain2.com ServerAlias *.domain2.com ServerAlias *.domain3.com ErrorLog /var/log/httpd/domain2.com.err.log CustomLog /var/log/httpd/domain2.com.log combined <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:7001/ ProxyPassReverse / ajp://localhost:7001/ </VirtualHost> <VirtualHost *:80> ServerName www.domain1.com ServerAlias *domain1.com ErrorLog /var/log/httpd/domain1.com.err.log CustomLog /var/log/httpd/domain1.com.log combined <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:7005/ ProxyPassReverse / ajp://localhost:7005/ </VirtualHost>
Finally there have to be some configuration at Tomcats side. Here is configuration from tomcat2
./conf/server.xml
file:
<Connector port="7001" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="www.domain2.com"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <Host name="repo.domain2" appBase="domain/repo.domain2.com" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> </Host> <Host name="www.domain2.com" appBase="domain/www.domain2.com" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>domain2.com</Alias> </Host> <Host name="www.domain3.com" appBase="domain/www.domain3.com" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Alias>domain2.com</Alias> </Host> </Engine>