Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm looking at something like this: http://serverfault.com/questions/22632/multiple-domains-including-www-subdomain-on-apache

And I'm too dumb to figure out how to get 1 subdomain to direct to 1 place.

I need

phpmyadmin.site.com/

to go to

/vol/www/phpMyAdmin

# Listen for virtual host requests on all IP addresses
NameVirtualHost phpmyadmin.site.com

<VirtualHost phpmyadmin.site.com>
DocumentRoot /vol/www/phpMyAdmin
ServerName phpmyadmin.site.com

# Other directives here

</VirtualHost>

just goes to site.com (i've restarted)

Thanks in advance.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Here's a sample:

NameVirtualHost *
<VirtualHost *>
    ServerName phpmyadmin.site.com
    DocumentRoot /vol/www/phpMyAdmin
    <Directory "/vol/www/phpMyAdmin">
        AllowOverride All
        Allow from all
    </Directory>
</VirtualHost>

This means receive requests to any ip (*)
This virtual host exists on all ips (*)

It responds to the request using ServerName in the URI
and it serves from the DocumentRoot specified

Make sure you have the <directory> directive too.

share|improve this answer

Here is excerpt from my apache config:

<VirtualHost *:80>
    ServerAdmin webmaster@xxx.com
    ServerName  xxx.com
    ServerAlias www.xxx.com
    DocumentRoot /srv/www/htdocs/xxx.com
    ErrorLog  /var/log/apache2/xxx.com-error_log
    CustomLog /var/log/apache2/xxx.com-access_log combined

   <Directory "/srv/www/htdocs/xxx.com">
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName  phpMyAdmin.xxx.com
    DocumentRoot /srv/www/htdocs/xxx.com/phpMyAdmin
    ErrorLog  /var/log/apache2/phpMyAdmin.xxx.com-error_log
    CustomLog /var/log/apache2/phpMyAdmin.xxx.com-access_log combined

   <Directory "/srv/www/htdocs/ccc.com/phpMyAdmin">
        AllowOverride All
        Options +FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.