Subdomain auf Apache

Subdomain auf Apache

Ich sehe mir so etwas an: Mehrere Domänen (einschließlich www-"Subdomäne") auf Apache?

Und ich bin zu dumm, um herauszufinden, wie ich eine Subdomäne dazu bringe, an einen Ort weiterzuleiten.

Ich brauche

phpmyadmin.site.com/

gehen zu

/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>

geht nur zu site.com (ich habe neu gestartet)

Dank im Voraus.

Antwort1

Hier ist ein Beispiel:

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

Das bedeutet, Anfragen an jede IP-Adresse zu empfangen ( *)
Dieser virtuelle Host existiert auf allen IP-Adressen ( *)

Es antwortet auf die Anfrage unter Verwendung des Servernamens in der URI
und bedient den Server aus dem angegebenen DocumentRoot.

Stellen Sie sicher, dass Sie auch die Richtlinie haben <directory>.

Antwort2

Hier ist ein Auszug aus meiner Apache-Konfiguration:

<VirtualHost *:80>
    ServerAdmin [email protected]
    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>

verwandte Informationen