I have a java application that responds to several domains and uses a specific apache virtual host for each domain. This is because Apache is faster than tomcat to serve static resources.
You must do this at runtime without configuring the apache configuration. To perform this action, I use the VirtualDocumentRoot directive, as described below:
AddType text/html .html .shtml AddOutputFilter INCLUDES .html .shtml NameVirtualHost *:80 UseCanonicalName Off <VirtualHost *:80> ServerName domain.com ServerAlias * # Define virtual host directory, using entire domain VirtualDocumentRoot /path/to/whosts/%0 # Define directory access <Directory "/path/to/whosts/"> Options -Indexes MultiViews +Includes Order allow,deny Allow from all </Directory> # Define Java Proxies <Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> # Allow Libs (static resources) to access apache directly ProxyPass /libs ! ProxyPass / ajp://localhost:8009/ ProxyPassReverse / ajp://localhost:8009/ </VirtualHost>
This does not work, because if I try to access www.domain.com, it is different from access to domain.com.
Do you think itβs a good idea to register a symbolic link from www.domain.comto domain.com ???
Is there another way to do this? I am very poor at managing Apache ...
Thanks a lot!
Qiao, David.
source share