You are not logged in.

#1 2008-01-25 19:35:20

Drakx
Member
Registered: 2008-01-14
Posts: 27

apache subdomain help

Hi

I've recentley got myself a server wich has arch setup and installed how ever i'm having some trouble with subdomains...


So I have a domain name thats in /home/user/public_html which when you use www.domain.com brings up the right page, how ever now i want todo http://subdns.domain.com ive edited vhosts.conf for apache and for some reason when i try it it shows me the main page as if i was doing www.domain.com and not sub.domain.com

here is the www.domain.com seciton:

<VirtualHost ip.here.thx:80> 
    ServerAdmin webmaster@domain.net 
    DocumentRoot "/home/user/public_html/" 
    <Directory /> 
       Options FollowSymLinks 
       AllowOverride All 
    </Directory> 
    <Directory /home/user/public_html> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       allow from all 
    </Directory> 
    
    ServerName www.domain.net 
    ServerAlias *.domain.net 
    ErrorLog "/var/log/httpd/domain.net-error_log" 
    CustomLog "/var/log/httpd/domain-access_log" common 
</VirtualHost>

This is the sub domain section...

<VirtualHost ip.here.thx:80> 
    ServerAdmin webmaster@domain.net 
    DocumentRoot "/home/user/public_html/subdomain" 
    <Directory /> 
       Options FollowSymLinks 
       AllowOverride All 
    </Directory> 
    <Directory /home/user/public_html/irpg> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       allow from all 
    </Directory> 
    
    ServerName sub.domain.net 
    ServerAlias *.sub.domain.net 
    ErrorLog "/var/log/httpd/domain.net-error_log" 
    CustomLog "/var/log/httpd/domain.net-access_log" common 
</VirtualHost>

Also I've noticed that i must place the ip address instead of like this:
<VirtualHost www.domain.net:80>
</VirtualHost>

Every time i try the above the website will not be shown any ideas?

Last edited by Drakx (2008-01-25 19:37:22)

Offline

#2 2008-01-25 20:45:00

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: apache subdomain help

dont put the serveralias *.domain.net in the first virtualhost entry.

If you want it to be the default, then just put it first in the apache config file.
The first virtual host listed is the 'fallback virtualhost'. Any names that do not match will just end up using that one.

my guess is the wildcard is matching the subdomain.domain.net, and skipping the second virtualhost.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB