Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = (

server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"             = "/var/run/"
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/ " + server.port
include_shell "/usr/share/lighttpd/"
include_shell "/usr/share/lighttpd/"
dir-listing.activate = "disable" #disable, so we can enable per directory
dir-listing.hide-dotfiles = "enable"
dir-listing.exclude = ( "^\~.*$" ) = "disable" = "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" )
share|improve this question

This actually says everything:

## the subdirectory of a user's home dir which should be accessible
## under http://$host/~$user
userdir.path         = "public_html"

You probably want userdir.path = "www", but it can't map http://x.x.x.x/project to /home/user/www/project, because how would it know the username? mod_userdir was not designed to work with mod_auth. So in your case a user bob would use http://x.x.x.x/~bob/project to access ~bob/www/project.


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.

share|improve this answer
Simply put "www" is not working, And also you are right with userdir i cant use mod_auth. – Pradeep Gupta Oct 1 '13 at 8:40
Can we change server.document-root in lighttpd.conf to user directories and can use some global variable so that lighttpd can recognize user? something like this ; /home/$USER, i am not sure which variable should i use here in place of $USER? – Pradeep Gupta Oct 1 '13 at 9:14
@PradeepGupta Updated the answer. I still think your current design is wrong though. – Stefan Oct 1 '13 at 12:51
Can you explain in more easy way and approach; i cant understand present given approach.? – Pradeep Gupta Oct 1 '13 at 13:26

I know this thread is old, but just for the log:

make sure that the public_html Folder is readable by lighttpd !

chmod a+rx /home/$USER/public_html
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.