Recently in Apache Category

Apache provides a very easy method to provide hosting for dynamically created sub-domains with "VirtualScriptAlias" and "VirtualDocumentRoot" syntaxes

Lets say, we have mydomain.com, and you need to dynamically configure test.mydomain.com, monkey.mydomain.com etc. (and not required to manually configure apache or restart), then..

Step 1: Configure wild-card DNS, so that *.mydomain.com is a cname to mydomain.com

Step 2: Configure apache. Create a new virtualhost section for *.mydomain.com, like:

<VirtualHost *>
ServerAlias *.mydomain.com
CustomLog /www/www.logs/virtual.mydomain.com-access_log combined
ErrorLog /www/www.logs/virtual.mydomain.com-error_log
VirtualDocumentRoot /www/www.mydomain.com/virtualdomains/%0/docs
VirtualScriptAlias  /www/www.mydomain.com/virtualdomains/%0/cgi-bin/
</VirtualHost>

Step 3: Restart apache to activate the new configuration

Step 4: Now, say you need test.mydomain.com, all that is required is to create /www/www.mydomain.com/virtualdomains/test.mydomain.com/docs and /www/www.mydomain.com/virtualdomains/test.mydomain.com/cgi-bin/

 

Technorati Tags: , , ,

If you have issues with tomcat not able to parse/display UTF characters, try adding URIEncoding="UTF-8" to your tomcat settings (server.xml).

Example:

<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>

About this Archive

This page is a archive of recent entries in the Apache category.

Database is the next category.

Find recent content on the main index or look in the archives to find all content.

Powered by
Movable Type 4.01