A lot of companies and universities allow members to use the $HOME/public_html directory as a root for their personal home pages. However, it seems the directory can only be served as a static site. Is it possible for members to serve non-static contents, e.g. to handle post requests or URL encoded parameters?


For httpd, once the mod_userdir directive UserDir has been used, Directory can be used on the paths to alter their behavior. Including adding CGI, as mentioned in the public_html howto:

<Directory "/home/*/public_html/cgi-bin/">
    Options ExecCGI
    SetHandler cgi-script

Scripts owned by any user is annoying to secure properly. An Ubuntu wiki page on doing user dir for PHP abandoned the suexec idea and only recommends mod_php. I doubt php-fpm works correctly with mod_user.

  • With PHP-FPM every user should have an own FPM pool. This might be possible to configure on Apache, but you'd need to add the pools manually. – Esa Jokinen Jun 2 at 9:14
  • Is CGI the only way to achieve this? – wlnirvana Jun 3 at 1:36
  • Please be more specific in what you want to accomplish, in what language. The point is that mod_userdir maps ~user to a directory for you. Devil is in the details of the security model of users executing code, plus which in process or CGI method you use: php-fpm, python mod_wsgi, mod_php, mod_perl, etc. etc. – John Mahowald Jun 3 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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