Hello list,
I have a problem here with apache and vhosts that I hope you can help me to solve.
I have apache 2.2.6 running in a box called myserver.university.edu
I start apache with the following options:
APACHE2_OPTS="-D DEFAULT_VHOST -D USERDIR -D PHP5"
With USERDIR active, users can use: http://myserver.university.edu/username to access their files. It works.
Now I have a user who adquired a domain (let's say: www.example.com) and wants to redirect it to his user folder. For this, I edited the file: 00_default_vhost.conf
It looks like this:
--------------------------------------------------------------------------------------------
<IfDefine DEFAULT_VHOST>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName myserver.university.edu
Include /etc/apache2/vhosts.d/default_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/group1/user1/public_html/
ServerName example.com
ServerAlias www.example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/group1/user1/public_html/subdomain1
ServerName subdomain1.example.com
</VirtualHost>
</IfDefine>
--------------------------------------------------------------------------------------------
The file: default_vhost.include ; looks like this:
--------------------------------------------------------------------------------------------
ServerAdmin root@localhost
DocumentRoot "/var/www/localhost/htdocs"
<Directory "/var/www/localhost/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
<Directory "/var/www/localhost/cgi-bin">
AllowOverride None
Options None
</Directory>
--------------------------------------------------------------------------------------------
The problem I am having is the following:
When I type: http://myserver.university.edu/username it works for any user.
When I type: http://subdomain1.example.com/ it shows the files hosted in /home/group1/user1/public_html/subdomain1
BUT, if I type: http://www.example.com or http://example.com, then, it doesn't show the files hosted in /home/group1/user1/public_html/ BUT it shows the files hosted in the root directory of apache: /var/www/localhost/htdocs
Can anyone help me? :-)