* [gentoo-user] Apache 2.2.6 - Problems with vhosts
@ 2008-11-12 8:59 Gololo
2008-11-12 9:19 ` Neil Bothwick
0 siblings, 1 reply; 5+ messages in thread
From: Gololo @ 2008-11-12 8:59 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]
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/usernameto 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? :-)
[-- Attachment #2: Type: text/html, Size: 3578 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Apache 2.2.6 - Problems with vhosts
2008-11-12 8:59 [gentoo-user] Apache 2.2.6 - Problems with vhosts Gololo
@ 2008-11-12 9:19 ` Neil Bothwick
2008-11-12 11:13 ` Gololo
0 siblings, 1 reply; 5+ messages in thread
From: Neil Bothwick @ 2008-11-12 9:19 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]
On Wed, 12 Nov 2008 09:59:59 +0100, Gololo wrote:
> 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>
You don't edit 00_default_vhost.conf, that for teh default setting (hint:
look at the name of the file). Put your settings in 01_domain.conf,
02_domain2.conf etc.
Secondly, you have only defined more default setups here. And where isthe
Directory stanza for the user dir? The contents of 01_example.com.conf
should be along the lines of
<VirtualHost www.example.com:80>
ServerAlias example.com
DocumentRoot "/home/group1/user1/public_html"
<Directory "/var/www/stfw.net/htdocs">
Options Indexes
order allow,deny
Allow from all
</Directory>
</VirtualHost>
--
Neil Bothwick
WinErr 011: Window open - Do not look outside
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Apache 2.2.6 - Problems with vhosts
2008-11-12 9:19 ` Neil Bothwick
@ 2008-11-12 11:13 ` Gololo
2008-11-12 11:46 ` Neil Bothwick
0 siblings, 1 reply; 5+ messages in thread
From: Gololo @ 2008-11-12 11:13 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]
Ok, thanks for the quick answer. I will try this in a second, but, just a
couple of questions.
1) DocumentRoot "/home/group1/user1/public_html"
<Directory "/var/www/stfw.net/htdocs">
Should I write there the same path there? I mean, should I write the
path to the public_html directory both in DocumentRoot and in Directory?
2) How should I add the subdomains in this 01_example.com.conf. Would it be
something like this?
<VirtualHost subd1.example.com:80 <http://www.example.com/>>
DocumentRoot "/home/group1/user1/public_html/subd1/"
<Directory "/var/www/stfw.net/htdocs">
Options Indexes
order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks!
You don't edit 00_default_vhost.conf, that for teh default setting (hint:
> look at the name of the file). Put your settings in 01_domain.conf,
> 02_domain2.conf etc.
>
> Secondly, you have only defined more default setups here. And where isthe
> Directory stanza for the user dir? The contents of 01_example.com.conf
> should be along the lines of
>
> <VirtualHost www.example.com:80>
> ServerAlias example.com
> DocumentRoot "/home/group1/user1/public_html"
> <Directory "/var/www/stfw.net/htdocs">
> Options Indexes
> order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
>
> --
> Neil Bothwick
>
> WinErr 011: Window open - Do not look outside
>
[-- Attachment #2: Type: text/html, Size: 2764 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Apache 2.2.6 - Problems with vhosts
2008-11-12 11:13 ` Gololo
@ 2008-11-12 11:46 ` Neil Bothwick
2008-11-12 13:04 ` Gololo
0 siblings, 1 reply; 5+ messages in thread
From: Neil Bothwick @ 2008-11-12 11:46 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
On Wed, 12 Nov 2008 12:13:51 +0100, Gololo wrote:
> Ok, thanks for the quick answer. I will try this in a second, but, just
> a couple of questions.
Please do not top post.
> 1) DocumentRoot "/home/group1/user1/public_html"
> <Directory "/var/www/stfw.net/htdocs">
> Should I write there the same path there? I mean, should I write
> the path to the public_html directory both in DocumentRoot and in
> Directory?
Sorry, I cut'n'pasted that from a working config and missed changing
one of the paths. The Directory and DocumentRoot paths should be the
same.
> 2) How should I add the subdomains in this 01_example.com.conf. Would
> it be something like this?
I'd put each one as a separate vhost.
--
Neil Bothwick
Just when my ship comes in, it's the Kobyashi Maru.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Apache 2.2.6 - Problems with vhosts
2008-11-12 11:46 ` Neil Bothwick
@ 2008-11-12 13:04 ` Gololo
0 siblings, 0 replies; 5+ messages in thread
From: Gololo @ 2008-11-12 13:04 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
Hello again,
I followed the solution you propposed and I got this error in the error_log
of apache:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that
RewriteRule directive is forbidden: /home/protel/gololo/public_html/
Plus I got a "403 Forbidden" in the browser".
So I changed the: "Options Indexes" with "Options Indexes FollowSymLinks
SymLinksIfOwnerMatch"
Now, www.example.com is working, but, any request of the short:
http://myserver.university.edu/username is redirected to
www.example.com/username which should not be happening
Any help on this would me much appreciated.
PS. What do you mean with "top posting"? What is this?
[-- Attachment #2: Type: text/html, Size: 900 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-12 13:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 8:59 [gentoo-user] Apache 2.2.6 - Problems with vhosts Gololo
2008-11-12 9:19 ` Neil Bothwick
2008-11-12 11:13 ` Gololo
2008-11-12 11:46 ` Neil Bothwick
2008-11-12 13:04 ` Gololo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox