1 |
Hello list, |
2 |
I have a problem here with apache and vhosts that I hope you can help me to |
3 |
solve. |
4 |
|
5 |
I have apache 2.2.6 running in a box called myserver.university.edu |
6 |
I start apache with the following options: |
7 |
APACHE2_OPTS="-D DEFAULT_VHOST -D USERDIR -D PHP5" |
8 |
|
9 |
With USERDIR active, users can use: |
10 |
http://myserver.university.edu/usernameto access their files. It |
11 |
works. |
12 |
|
13 |
Now I have a user who adquired a domain (let's say: www.example.com) and |
14 |
wants to redirect it to his user folder. For this, I edited the file: |
15 |
00_default_vhost.conf |
16 |
It looks like this: |
17 |
|
18 |
-------------------------------------------------------------------------------------------- |
19 |
<IfDefine DEFAULT_VHOST> |
20 |
Listen 80 |
21 |
NameVirtualHost *:80 |
22 |
|
23 |
<VirtualHost *:80> |
24 |
ServerName myserver.university.edu |
25 |
Include /etc/apache2/vhosts.d/default_vhost.include |
26 |
<IfModule mpm_peruser_module> |
27 |
ServerEnvironment apache apache |
28 |
</IfModule> |
29 |
</VirtualHost> |
30 |
|
31 |
<VirtualHost *:80> |
32 |
DocumentRoot /home/group1/user1/public_html/ |
33 |
ServerName example.com |
34 |
ServerAlias www.example.com |
35 |
</VirtualHost> |
36 |
|
37 |
<VirtualHost *:80> |
38 |
DocumentRoot /home/group1/user1/public_html/subdomain1 |
39 |
ServerName subdomain1.example.com |
40 |
</VirtualHost> |
41 |
</IfDefine> |
42 |
|
43 |
-------------------------------------------------------------------------------------------- |
44 |
|
45 |
The file: default_vhost.include ; looks like this: |
46 |
|
47 |
-------------------------------------------------------------------------------------------- |
48 |
ServerAdmin root@localhost |
49 |
DocumentRoot "/var/www/localhost/htdocs" |
50 |
<Directory "/var/www/localhost/htdocs"> |
51 |
Options Indexes FollowSymLinks |
52 |
AllowOverride All |
53 |
</Directory> |
54 |
<Directory "/var/www/localhost/cgi-bin"> |
55 |
AllowOverride None |
56 |
Options None |
57 |
</Directory> |
58 |
-------------------------------------------------------------------------------------------- |
59 |
|
60 |
The problem I am having is the following: |
61 |
|
62 |
When I type: http://myserver.university.edu/username it works for any user. |
63 |
|
64 |
When I type: http://subdomain1.example.com/ it shows the files hosted in |
65 |
/home/group1/user1/public_html/subdomain1 |
66 |
|
67 |
BUT, if I type: http://www.example.com or http://example.com, then, it |
68 |
doesn't show the files hosted in /home/group1/user1/public_html/ BUT it |
69 |
shows the files hosted in the root directory of apache: |
70 |
/var/www/localhost/htdocs |
71 |
|
72 |
Can anyone help me? :-) |