archlinux apache subdomain

Hi

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 *.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:

www.domain.net:80>

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

Thanks

2 Replies

@Drakx:

 <virtualhost ip.here.thx:80="">...
    ServerName www.domain.net
    ServerAlias *.domain.net
...</virtualhost> 
 <virtualhost ip.here.thx:80="">...
    ServerName sub.domain.net
    ServerAlias *.domain.net
...</virtualhost> 

If you pasted these in the order they appear to apache, anything.domain.com will be caught by the first block, because you have a *.domain.com for the alias.

hmm ok so ive changed the server aliases to

www.domain.com

and

sub.domain.com

still shows www.domain.com site on sub.domain.com but the folder i made for sub.domain.com should be empty

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct