Re: httpd and ~user directories
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
Re: httpd and ~user directories
On Sat, Jan 03, 2015 at 11:29:32PM +0100, Reyk Floeter wrote: - 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). [ snip ] Thank you for your kind way of telling me I was doing it wrong! :-) Until chrisz@' commit (and when I'm running -current), I'll fudge the directory structure by creating symbolic links: location /~* { root /htdocs/users } Then in /htdocs/users, for each user's directory: drwxr-xr-x 2 1017 www 512 Mar 4 2013 user1 drwxr-x--x 5 1009 www 1024 Jul 20 2013 user2 .. drwxr-x--x 6 1004 www 512 May 30 2014 userN I do: $ ln -s user1 ./~user1 $ ln -s user2 ./~user2 .. $ ln -s userN ./~userN This seems indeed to do the (ugly) trick. Many thanks for the super quick reply! Tor
httpd and ~user directories
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? Kind regards, Tor