I've got a server (runnging Debian Squeeze) with Apache 2.2, there are 4 site running there.I'm using namebased virtulhosts because I've got a single IP. Initial configuration has been made with Webmin and probably something has been messed up..
firstdomain.com is my default domain and is working correctly, seconddomain.com is another site that is working. Now I want to add lastdomain.tk as a new site, so I've made this config file:
root@webamp:/etc/apache2# cat sites-available/lastdomain.tk.conf <VirtualHost *:80>DocumentRoot /home/server/Condivisione/RAID/lastdomain.tkServerName www.alazanes.tkServerAlias alazanes.tk</VirtualHost>
I've added it to enabled-sites and restarted apache.The problem is that if I go to lastdomain.tk (or www.lastdomain.tk) I'm redirected to firstdomain.com with a 301 redirect.
Both lastdomain.tk and www.lastdomain.tk are A DNS records pointing to my IP address.
Strange thing is that if a change DocumentRoot of lastdomain.tk to
DocumentRoot /home/server/Condivisione/RAID/Sito_SecondDomain
I correctly see seconddomain.com content without being redirected (lastdomain.tk is showed on address bar)
These are the other configurations I'm using.
root@webamp:/root# source /etc/apache2/envvars ; /usr/sbin/apache2 -SVirtualHost configuration:wildcard NameVirtualHosts and _default_ servers:*:443 webamp.firstdomain.com (/etc/apache2/sites-enabled/ssl.bbteam:1)*:80 is a NameVirtualHost default server firstdomain.com (/etc/apache2/sites-enabled/000-default:7) port 80 namevhost firstdomain.com (/etc/apache2/sites-enabled/000-default:7) port 80 namevhost www.lastdomain.tk (/etc/apache2/sites-enabled/lastdomain.tk.conf:1) ## other domains ## port 80 namevhost seconddomain.com (/etc/apache2/sites-enabled/seconddomain.com.conf:1)Syntax OK
Content of default config file is
root@webamp:/etc/apache2# cat sites-available/default<VirtualHost *:80>ServerAdmin francesco@firstdomain.comServerName firstdomain.comServerAlias www.firstdomain.com direct.firstdomain.comDocumentRoot /home/server/Condivisione/RAID/Sito_Web_Apache_su_80ErrorLog /var/log/apache2/error.logLogLevel warnCustomLog /var/log/apache2/access.log combined</VirtualHost>
content of second domain config file is
root@webamp:/etc/apache2# cat sites-available/seconddomain.com.conf <VirtualHost *:80>DocumentRoot /home/server/Condivisione/RAID/Sito_SecondDomainServerName seconddomain.comServerAlias www.seconddomain.com direct.seconddomain.com#redirect 301 / http://www.seconddomain.com/<Directory "/home/server/Condivisione/RAID/Sito_SecondDomain"> allow from all Options +Indexes</Directory></VirtualHost>
Probably a file permission problem?
root@webamp:/root# ls -lh /home/server/Condivisione/RAID/total 7.1Mdrwxrwxr-x 15 www-data server 4.0K Jun 5 13:29 Sito_SecondDomaindrwxrwxrwx 23 server server 4.0K Jun 7 16:22 Sito_Web_Apache_su_80drwxrwxr-x 17 www-data server 4.0K Jun 8 09:56 lastdomain.tk
Do someone have an idea of what is happening?
Thanks, Francesco
Update
Even if I use a subdirectory it is 301 redirected, like if I navigate to
lastdomain.tk/install
I'm redirected to
firstdomain.com/install