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>
    ServerName website.com
    DocumentRoot /var/www/website.com
    <IfModule mpm_itk_module>
        AssignUserId username groupname
    </IfModule>
</VirtualHost>

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.
   ...fail!

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.


*