how to setup subdomains
I am a newby owning a linode and would like to know how to setup subdomains.
Having my main domain,
The idea is to get
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!
8 Replies
@dolphin:
yes Sir!
Can you paste in your vhost config?
@dolphin:
how do I get it?
:roll: @dolphin: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…
default
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
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!
@dolphin:
NameVirtualHost progesoft.grandolini.info <virtualhost progesoft.grandolini.info=""></virtualhost>
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:
<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>
it works!!
THANKS A LOT NEONNERO!