Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: New help on Subdomains
PostPosted: Fri Nov 04, 2011 3:14 am 
Offline
Senior Newbie

Joined: Fri May 20, 2011 7:34 am
Posts: 9
Hello,
I just installed Apache with PHP, MySQL and it works fine!

I got my website running working with a domain. But now i wish to have a sub-domain.
Can anyone help me? I am running on Ubuntu (Lucid).

Thanks!


Top
   
 Post subject:
PostPosted: Fri Nov 04, 2011 3:20 am 
Offline
Senior Member

Joined: Mon Sep 12, 2011 3:29 am
Posts: 63
ICQ: 1081190
Website: http://kyhwana.org
AOL: kyhwana
Location: New Zealand
I assume you want a seperate site on your sub-domain? Just add a virtualhost for the subdomain after pointing the A/AAAA records for your subdomain to your linodes IP(s)


Top
   
 Post subject:
PostPosted: Fri Nov 04, 2011 3:40 am 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
Linode Manager -> DNS Manager -> your domain -> A/AAAA Records -> Add a new A record -> Hostname: subdomain.yourdomain.com IP Address: your linode's IP -> Save changes -> Configure a vhost in apache for your subdomain the same way you configured your main domain.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Wed Nov 09, 2011 3:34 am 
Offline
Senior Newbie

Joined: Fri May 20, 2011 7:34 am
Posts: 9
Thanks for replying. I will try the advice.


Top
   
 Post subject:
PostPosted: Wed Nov 09, 2011 4:00 am 
Offline
Senior Newbie

Joined: Fri May 20, 2011 7:34 am
Posts: 9
Problem Configuring Name-based Virtual Hosts.
When i installed the domain, I used Apache default settings/files.

Just now i tried to add another website (sub-domain), but there was a problem. When i type in the browser "www.domain.net" it loads the 'subdomain.domain.net" folder in the server not the "domain.net".

Domain.net
Code:
<VirtualHost 106.187.45.239:80>
     ServerAdmin seaarmy@live.com
     ServerName th-gaming.net
     ServerAlias th-gaming.net
     DocumentRoot /srv/www/th-gaming.net/public_html/
     ErrorLog /srv/www/th-gaming.net/logs/error.log
     CustomLog /srv/www/th-gaming.net/logs/access.log combined
</VirtualHost>


Subdomain.domain.net
Code:
<VirtualHost 106.187.45.239:80>
     ServerAdmin seaarmy@live.com
     ServerName minecraft.th-gaming.net
     ServerAlias minecraft.th-gaming.net
     DocumentRoot /srv/www/minecraft.th-gaming.net/public_html/
     ErrorLog /srv/www/minecraft.th-gaming.net/logs/error.log
     CustomLog /srv/www/minecraft.th-gaming.net/logs/access.log combined
</VirtualHost>


A RECORDS
Code:
A/AAAA Records
Hostname   IP Address   TTL   Options
106.187.45.239    Default   Edit | Remove
mail   106.187.45.239    Default   Edit | Remove
minecraft   106.187.45.239    Default   Edit | Remove
www   106.187.45.239    Default   Edit | Remove



Any suggestions? I followed the guide from Linode.


Top
   
 Post subject:
PostPosted: Wed Nov 09, 2011 4:15 am 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Something is messed up in your DNS (or it just has propagated yet)

Code:
C:\>ping th-gaming.net

Pinging th-gaming.net [67.215.66.132] with 32 bytes of data:

Reply from 67.215.66.132: bytes=32 time=66ms TTL=48
Reply from 67.215.66.132: bytes=32 time=682ms TTL=48
Reply from 67.215.66.132: bytes=32 time=63ms TTL=48
Reply from 67.215.66.132: bytes=32 time=64ms TTL=48

Ping statistics for 67.215.66.132:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 63ms, Maximum = 682ms, Average = 218ms

C:\>ping www.th-gaming.net

Pinging www.th-gaming.net [106.187.45.239] with 32 bytes of data:

Reply from 106.187.45.239: bytes=32 time=165ms TTL=46
Reply from 106.187.45.239: bytes=32 time=164ms TTL=46
Reply from 106.187.45.239: bytes=32 time=165ms TTL=46
Reply from 106.187.45.239: bytes=32 time=164ms TTL=46

Ping statistics for 106.187.45.239:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 164ms, Maximum = 165ms, Average = 164ms

C:\>ping minecraft.th-gaming.net

Pinging minecraft.th-gaming.net [67.215.66.132] with 32 bytes of data:

Reply from 67.215.66.132: bytes=32 time=63ms TTL=48
Reply from 67.215.66.132: bytes=32 time=64ms TTL=48
Reply from 67.215.66.132: bytes=32 time=65ms TTL=48
Reply from 67.215.66.132: bytes=32 time=62ms TTL=48

Ping statistics for 67.215.66.132:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 62ms, Maximum = 65ms, Average = 63ms


Also you don't need a "serveralias" if it's the same as "servername"

You don' t have a vhost entry for www.th-gaming.net

Did you remember to restart Apache after you changed the vhost config's?


Top
   
 Post subject:
PostPosted: Wed Nov 09, 2011 4:39 am 
Offline
Senior Newbie

Joined: Fri May 20, 2011 7:34 am
Posts: 9
I reload the server everytime i change the vHost.

Ok, I remove "ServerAllias" in both files.
And reloaded Apache again but this time with this error.
Code:
root@li388-239:~# /etc/init.d/apache2 reload
 * Reloading web server config apache2                                                                                [Wed Nov 09 03:39:02 2011] [warn] VirtualHost 106.187.45.239:80 overlaps with VirtualHost 1                           06.187.45.239:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Wed Nov 09 03:39:02 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
                                                                                    [ OK ]


I think it's because i accidentally remove the "default" files and then put this back instead, replacing it.

Code:
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                RedirectMatch ^/$ /apache2-default/
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>





Might be because of the propagation.
Or do you want me to re-install everything? And do it again.
I kinda messed it up here.


Last edited by seaarmy on Wed Nov 09, 2011 5:01 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Wed Nov 09, 2011 4:44 am 
Offline
Senior Newbie

Joined: Fri May 20, 2011 7:34 am
Posts: 9
***Not a bump but can't delete this post***


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group