I am using Debian 7 based host and configure PHP-FPM and lighttpd along with rutorrent on this host. I wants to use user directories instead of default /var/www path.
I already run following command to activate user directories.But unable to use them.
root@x.x.x.x# lighty-enable-mod userdir
One thing more what should write in following line of /etc/lighttpd/conf-available/10-userdir.conf file; so that www://x.x.x.x./project should point to /home/user/www/project? I am also using authentication here, so user1 will see his home directory and user2 will see his home directories.
userdir.path = "public_html"
/etc/lighttpd/lighttpd.conf is here:
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_scgi",
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html$
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/htm$
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
dir-listing.activate = "disable" #disable, so we can enable per directory
dir-listing.hide-dotfiles = "enable"
dir-listing.exclude = ( "^\~.*$" )
dir-listing.show-readme = "disable"
dir-listing.show-header = "disable"
dir-listing.hide-readme-file = "disable"
dir-listing.hide-header-file = "disable"
dir-listing.set-footer = "SeedStorm"
10-userdir.conf here:
## The userdir module provides a simple way to link user-based directories into
## the global namespace of the webserver.
##
# /usr/share/doc/lighttpd/userdir.txt
server.modules += ( "mod_userdir" )
## the subdirectory of a user's home dir which should be accessible
## under http://$host/~$user
userdir.path = "public_html"
## The users whose home directories should not be accessible
userdir.exclude-user = ( "root", "postmaster" )
Best Answer
This actually says everything:
You probably want
userdir.path = "www"
, but it can't maphttp://x.x.x.x/project
to/home/user/www/project
, because how would it know the username?mod_userdir
was not designed to work withmod_auth
. So in your case a userbob
would usehttp://x.x.x.x/~bob/project
to access~bob/www/project
.Edit
Content should imho not depend on authentication (mod_auth); perhaps one day user bob wants access to a project from user alice?
Depending on authorization is ok; as you give a user "authorization" to access certain data its presentation may change. Depending on authorization a user can get
403 Forbidden
, read only access, (limited) write access, complete admin access, ...That said, you might be able to create your own phyiscal path mapping with mod_magnet, which also could include the username from the
Authorization
header (also see #2495).Given that this is strongly discouraged there is no "easy" way to do this. "Variables" in the config are evaluated at startup (check output from
lighttpd -p -f ...
), there are no "variables" at runtime; only some modules provide special pattern handling (mod_rewrite, mod_redirect) using captured groups from regular expression matches.