On Sat, Jan 03, 2015 at 10:33:52PM +0100, Tor Houghton wrote:
> Hello,
> 
> I'm wondering if there is a plan to add support for ~user style URL 
> expansion to the new httpd.
> 
> I've tried fudging it for 'someuser' by adding the following to the default
> server within /etc/httpd.conf, but to no avail:
> 
>       location "/~someuser/*" {
>               root "/htdocs/users/someuser"
>       }
> 
> (I also tried creating a directory '/htdocs/~someuser', but that didn't work
> either, thankfully.)
> 
> I'm running 5.6 (not -current; so I should probably do that), but looking at
> the current commits, I can't see that this is supported right now?
> 
> Or am I doing it wrong?
> 

- User directories are not explicitly supported and have to be  
within the chroot - somewhere in /var/www.  

- For example, you can currently create user directories the following way:

# mkdir /var/www/users/~reyk
# ln -s /var/www/users/reyk ~reyk/public_html
# echo Hallo > /var/www/users/~reyk/index.html

        location "/~*" {
                root "/users"
        }
  
- For your snippet, you would need an upcoming feature from chrisz@ to
strip elements from the request path (so it can be done without
rewrite/regex).

Currently, a client requesting http://somehost/~someuser/ would end up
in /var/www/htdocs/users/someuser/~someuser/ - which does not exist.

        location "/~someuser/*" {
                root "/htdocs/users/someuser"
        }

You can fix the path by stripping the last path element so that it
turns into /var/www/htdocs/users/someuser.

        location "/~someuser/*" {
                root { "/htdocs/users/someuser", strip 1 }
        }

Reyk

Reply via email to