FollowSymLinks and Virtual host

This is a discussion on FollowSymLinks and Virtual host within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello, I'm trying to setup Apache to server virtual hosts from user's home directories, and having problem with ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-18-2003
Scott Seong
 
Posts: n/a
Default FollowSymLinks and Virtual host

Hello,

I'm trying to setup Apache to server virtual hosts from user's home
directories, and having problem with symbolic links. The document root of
each virtual host is /var/www/html/{www.domainname.tld} and they're symbolic
linked to user's home directory (i.e. /home/{username}/{www.domainname.tld}.
I would like the users to FTP their web contents to their home directory,
and have apache serve pages from symlinked directory. For example, assuming
that a username is 'johndoe' and a domainname is helloworld.com.

/home/johndoe/www.helloworld.com (directory containing helloworld.com web
contents).
/var/www/html/www.helloworld.com -> /home/johndoe/www.helloworld.com
(document root, symlinked to user's home directory).

The /etc/httpd/conf/httpd.conf contains the following virtual host
configuration as explained in the
Httpd 2.0 documentation. I'm using ficticious private IP instead of public
IP in the example below.

-- sample httpd.conf starts
DocumentRoot "/home"
....

NameVirtualHost 192.168.1.2:80

<VirtualHost 192.168.1.2:80>
ServerAdmin admin@helloworld.com
ServerName %0
VirtualDocumentRoot /var/www/html/%0
<directory /var/www/html/%0>
options ExecCGI FollowSymLinks
</directory>
</VirtualHost>
-- end of httpd.conf

I'm having a permission problem and redirected to a "forbidden" page with
"You don't have permission to access / on this server." error. I understand
that Apache doesn't allow symlinks outside of document root, so I have tried
adding DocumentRoot "/home" but that doesn't help. Is there a way for Apache
to follow symlinks to certain directory (i.e. /home) or change DocumentRoot
to include '/home' in addition to /var/www/html/{www.domainname.tld}?

Thanks much for your help.
Scott Seong


  #2 (permalink)  
Old 08-19-2003
Scott Seong
 
Posts: n/a
Default Re: FollowSymLinks and Virtual host

Here is a little more explaination.

The problem I'm trying to solve is to allow Apache to follow symbolic link
to /home/{username}/{www.domainname.tld} from /var/www/html/%0 document
root. Yes, I'm configuring Apache to
do mass virtual host, so that I don't have to restart apach everytime a
www.domainame.tld is added. The config came from Apache 2.0 documentation
and it seems to work fine, execept for following symbolic links. The apache
error log says, ...

Symbolic link not allowed: /var/www/html/www.helloworld.com

On a side note, I'm also running vsftpd which runs with chrroot option which
prevents a user from
going outside of his/her home directory hierarchy. So, I can't have a
symbolic link in user's home pointing to /var/www/html/www.domainname.tld
since the user has no access outside of his/her home. If I have to serve the
content from user's home, I'll have to add a virtual host entry for each
domainname and restart apache every time a domainname is added. I'm trying
to avoid this. Can someone help?

Thank you,
Scott


"rach" <kjkfjgndfjg.fgdfg@dfgdnfgdf.net> wrote in message
news:mQe0b.43630$Nf.95863@sea-read.news.verio.net...
>
> "Scott Seong" <aladar@megapathdsl.net> wrote in message
> news:vk2k32cdjglnb8@corp.supernews.com...
> > Hello,
> >
> > I'm trying to setup Apache to server virtual hosts from user's home
> > directories, and having problem with symbolic links. The document root

of
> > each virtual host is /var/www/html/{www.domainname.tld} and they're

> symbolic
> > linked to user's home directory (i.e.

> /home/{username}/{www.domainname.tld}.
> > I would like the users to FTP their web contents to their home

directory,
> > and have apache serve pages from symlinked directory. For example,

> assuming
> > that a username is 'johndoe' and a domainname is helloworld.com.
> >
> > /home/johndoe/www.helloworld.com (directory containing helloworld.com

web
> > contents).
> > /var/www/html/www.helloworld.com -> /home/johndoe/www.helloworld.com
> > (document root, symlinked to user's home directory).
> >
> > The /etc/httpd/conf/httpd.conf contains the following virtual host
> > configuration as explained in the
> > Httpd 2.0 documentation. I'm using ficticious private IP instead of

public
> > IP in the example below.
> >
> > -- sample httpd.conf starts
> > DocumentRoot "/home"
> > ...
> >
> > NameVirtualHost 192.168.1.2:80
> >
> > <VirtualHost 192.168.1.2:80>
> > ServerAdmin admin@helloworld.com
> > ServerName %0
> > VirtualDocumentRoot /var/www/html/%0
> > <directory /var/www/html/%0>
> > options ExecCGI FollowSymLinks
> > </directory>
> > </VirtualHost>
> > -- end of httpd.conf
> >
> > I'm having a permission problem and redirected to a "forbidden" page

with
> > "You don't have permission to access / on this server." error. I

> understand
> > that Apache doesn't allow symlinks outside of document root, so I have

> tried
> > adding DocumentRoot "/home" but that doesn't help. Is there a way for

> Apache
> > to follow symlinks to certain directory (i.e. /home) or change

> DocumentRoot
> > to include '/home' in addition to /var/www/html/{www.domainname.tld}?
> >
> > Thanks much for your help.
> > Scott Seong
> >
> >

>
> Note: I should have said: VirtualDocumentRoot /var/www/html/%0 not:
> VirtualDocumentRoot /var/www/html/%0/ as I did in the original post.
>
> ==
>
> I have never heard of using the %0 value with namevirualhost. Rather that

is
> used with "Dynamically configured mass virtual hosting"
> http://httpd.apache.org/docs-2.0/vhosts/mass.html .
>
> So you would use:
>
> UseCanonicalName Off
>
> <directory /var/www/html>
> options +ExecCGI FollowSymLinks
> </directory>
>
> LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
> CustomLog logs/access_log vcommon
>
> VirtualDocumentRoot /var/www/html/%0
>
> Rach
>
>



  #3 (permalink)  
Old 08-19-2003
Scott Seong
 
Posts: n/a
Default Re: FollowSymLinks and Virtual host

Rach,

Thanks for your help. Although I couldn't get the symlinks to work
correctly, I was able to work around by using mod_rewrite approach described
in the same documentation (i.e.
http://httpd.apache.org/docs-2.0/vhosts/mass.html). The only part that I'm
having trouble at the moment is handling of SSL pages (see my other post,
"ModRewrite VirtualHost and SSL").

Scott Seong

"rach" <kjkfjgndfjg.fgdfg@dfgdnfgdf.net> wrote in message
news:mQe0b.43630$Nf.95863@sea-read.news.verio.net...
>
> "Scott Seong" <aladar@megapathdsl.net> wrote in message
> news:vk2k32cdjglnb8@corp.supernews.com...
> > Hello,
> >
> > I'm trying to setup Apache to server virtual hosts from user's home
> > directories, and having problem with symbolic links. The document root

of
> > each virtual host is /var/www/html/{www.domainname.tld} and they're

> symbolic
> > linked to user's home directory (i.e.

> /home/{username}/{www.domainname.tld}.
> > I would like the users to FTP their web contents to their home

directory,
> > and have apache serve pages from symlinked directory. For example,

> assuming
> > that a username is 'johndoe' and a domainname is helloworld.com.
> >
> > /home/johndoe/www.helloworld.com (directory containing helloworld.com

web
> > contents).
> > /var/www/html/www.helloworld.com -> /home/johndoe/www.helloworld.com
> > (document root, symlinked to user's home directory).
> >
> > The /etc/httpd/conf/httpd.conf contains the following virtual host
> > configuration as explained in the
> > Httpd 2.0 documentation. I'm using ficticious private IP instead of

public
> > IP in the example below.
> >
> > -- sample httpd.conf starts
> > DocumentRoot "/home"
> > ...
> >
> > NameVirtualHost 192.168.1.2:80
> >
> > <VirtualHost 192.168.1.2:80>
> > ServerAdmin admin@helloworld.com
> > ServerName %0
> > VirtualDocumentRoot /var/www/html/%0
> > <directory /var/www/html/%0>
> > options ExecCGI FollowSymLinks
> > </directory>
> > </VirtualHost>
> > -- end of httpd.conf
> >
> > I'm having a permission problem and redirected to a "forbidden" page

with
> > "You don't have permission to access / on this server." error. I

> understand
> > that Apache doesn't allow symlinks outside of document root, so I have

> tried
> > adding DocumentRoot "/home" but that doesn't help. Is there a way for

> Apache
> > to follow symlinks to certain directory (i.e. /home) or change

> DocumentRoot
> > to include '/home' in addition to /var/www/html/{www.domainname.tld}?
> >
> > Thanks much for your help.
> > Scott Seong
> >
> >

>
> Note: I should have said: VirtualDocumentRoot /var/www/html/%0 not:
> VirtualDocumentRoot /var/www/html/%0/ as I did in the original post.
>
> ==
>
> I have never heard of using the %0 value with namevirualhost. Rather that

is
> used with "Dynamically configured mass virtual hosting"
> http://httpd.apache.org/docs-2.0/vhosts/mass.html .
>
> So you would use:
>
> UseCanonicalName Off
>
> <directory /var/www/html>
> options +ExecCGI FollowSymLinks
> </directory>
>
> LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
> CustomLog logs/access_log vcommon
>
> VirtualDocumentRoot /var/www/html/%0
>
> Rach
>
>



  #4 (permalink)  
Old 08-19-2003
Claudio Carobolante
 
Posts: n/a
Default Re: FollowSymLinks and Virtual host

Scott Seong schrieb:


> [...] Symbolic link not allowed: /var/www/html/www.helloworld.com [...]


Thanks for posting your ErrorLOg file.

Apache doc:
FollowSymLinks
The server will follow symbolic links in this directory.

/var/www/html/%0 its too late.

# Follow symlinks in all folders
<directory />
options followsymlinks
</directory>

cc
  #5 (permalink)  
Old 08-20-2003
Olezhka
 
Posts: n/a
Default FollowSymLinks question

Hi everybody,

I tried to symlink some directory to DocumentRoot. I used DEFAULT Apache
configuration on RedHat 8.0, and got very interesting results:

- When I link directory tree of the same filesystem as DocumentRoot
(/var/www/html), everything works perfect.

- When I link directory tree of OTHER filesystem (in my case, mounted
NTFS volume) - Apache follows all tree hierarchy, but GET returns files
with zero size ! NO errors, warning, NOTHING !!


Somebody knows what happened :-) ?

Thanx a lot,
Oleg.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:52 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0