Linode Forum
https://forum.linode.com/

how to setup subdomains
https://forum.linode.com/viewtopic.php?f=19&t=3421
Page 1 of 1

Author:  dolphin [ Tue Aug 05, 2008 4:25 am ]
Post subject:  how to setup subdomains

Sorry but I couldn't find any help on other topics.

I am a newby owning a linode and would like to know how to setup subdomains.
Having my main domain, http://example.com, properly running I added an entry in the A records like subdomain (linode dns manager).
The idea is to get http://subdomain.example.com showing a different site than the one presented with http://example.com

I setted up a couple of virtual servers in apache2 pointing to the destination directories pending on the NameVirtualHost directive.

Now the issue is that I get the same contents (the subdomain ones) both directing the browser to the main and the subdomain sites...

what am I doing wrong?

thanks a lot in advance to anyone helping me!

Author:  anderiv [ Tue Aug 05, 2008 12:00 pm ]
Post subject: 

Did you restart apache after adding the vhosts?

Author:  dolphin [ Tue Aug 05, 2008 1:09 pm ]
Post subject: 

yes Sir!

Author:  anderiv [ Tue Aug 05, 2008 1:10 pm ]
Post subject: 

dolphin wrote:
yes Sir!


Can you paste in your vhost config?

Author:  dolphin [ Tue Aug 05, 2008 1:17 pm ]
Post subject: 

how do I get it?
:roll:

Author:  anderiv [ Tue Aug 05, 2008 1:19 pm ]
Post subject: 

dolphin wrote:
how do I get it?
:roll:
dolphin wrote:
I setted up a couple of virtual servers in apache2 pointing to the destination directories pending on the NameVirtualHost directive.


You said you already set up the vhosts. Just copy/paste that...

Author:  dolphin [ Tue Aug 05, 2008 1:28 pm ]
Post subject: 

sorry,

default

Code:
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost
        ServerName grandolini.info
        ServerAlias www.grandolini.info

DocumentRoot /home/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /home/www/log/apache2-error.log

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

        CustomLog /home/www/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>


subdomain

Code:
NameVirtualHost progesoft.grandolini.info
<VirtualHost progesoft.grandolini.info>
        ServerAdmin ugo@progesoft.com
        ServerName progesoft.grandolini.info
        ServerAlias www.progesoft.grandolini.info

DocumentRoot /home/www/progeSOFT
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/www/progeSOFT/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /home/www/log/progeSOFT/apache2-error.log

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

        CustomLog /home/www/log/progeSOFT/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>


thanks a lot!

Author:  NeonNero [ Tue Aug 05, 2008 1:41 pm ]
Post subject: 

dolphin wrote:
Code:
NameVirtualHost progesoft.grandolini.info
<VirtualHost progesoft.grandolini.info>

That just might be your problem, then. From what I understand from the Apache manual, NameVirtualHost needs to be an IP address or an IP adress with a port specification (either can be just a "*" to denote all possibilities).

Since you've already used "NameVirtualHost *" in the default file, you don't need to set it again. Just do it like this for your subdomain:

Code:
<VirtualHost *> 
        ServerAdmin ugo@progesoft.com
        ServerName progesoft.grandolini.info
        ServerAlias www.progesoft.grandolini.info

DocumentRoot /home/www/progeSOFT
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/www/progeSOFT/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </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 /home/www/log/progeSOFT/apache2-error.log

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

        CustomLog /home/www/log/progeSOFT/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>

Author:  dolphin [ Tue Aug 05, 2008 1:50 pm ]
Post subject: 

YEEEE :D

it works!!
THANKS A LOT NEONNERO!

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/