Multiuser environment

Is it possible to use caddy on a multiuser environment (users having their webpages under $HOME directory, like public_html or similar)? If so, how?

For example, on nginx, something like this works:

location ~ ^/(.+?)(/.*)?$ {
  alias /home/$1/public_html$2;
  index  index.html index.htm;
  autoindex on;
}

Is it possible with caddy?

Yes, you can use a rewrite, with a root in /home:

root /home
rewrite {
    regexp ^/(.+?)(/.*)?$
    to /home/{1}/public_html{2}
}
browse

I haven’t tested this, but something like this should work, I think.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.