Run Apache2 as specific user, non-root

It is very easy but hard to find exact syntax. None of the current google top searches bring it out. You have to use mpm_itk module and exact example of syntax is here, enjoy!

<VirtualHost *:80>
    DocumentRoot /var/www/
    <IfModule mpm_itk_module>
        AssignUserId username groupname

In case you see error like this

Invalid command 'AssignUserId', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.!

Then install the mpm_itk module in ubuntu like this

sudo apt-get install apache2-mpm-itk

Leave a Reply

Your email address will not be published.