LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Fast subdomains in VirtualHost - how? (http://www.linuxquestions.org/questions/linux-server-73/fast-subdomains-in-virtualhost-how-694049/)

Tomek58 12-31-2008 07:49 AM

Fast subdomains in VirtualHost - how?
 
Hello!
I have Apache2 but i don't have server DNS, so i connected my domain to IP adress.

In /etc/apache2/sites-available/default i have:

PHP Code:

NameVirtualHost ip.ip.ip.ip

<VirtualHost ip.ip.ip.ip>
 
DocumentRoot /var/www
 ServerName domain
.com
</VirtualHost>

<
VirtualHost ip.ip.ip.ip>
 
DocumentRoot /var/www
 ServerName www
.domain.com
</VirtualHost>

<
VirtualHost ip.ip.ip.ip>
 
DocumentRoot /var/www
 ServerName subdomain1
.domain.com
</VirtualHost>

<
VirtualHost ip.ip.ip.ip>
 
DocumentRoot /var/www
 ServerName www
.subdomain1.domain.com
</VirtualHost

(ip.ip.ip.ip is IP my server)

I would like so automatically:
www.subdomain2.domain.com -> /var/www/subdomain2
www.subdomain3.domain.com -> /var/www/subdomain3
www.subdomain4.domain.com -> /var/www/subdomain4
...
www.subdomain9999.domain.com -> /var/www/subdomain9999

trickykid 12-31-2008 09:18 AM

Probably mod_rewrite will do the job and or you could have index pages that redirect with a refresh. But to really accomplish what you're trying to do if you're going to use name based hosting to redirect, you need some type of DNS setup or you'll have to put the names and IP's in your local hosts file, etc.


All times are GMT -5. The time now is 08:22 PM.