Run Apache virtual host with its own user and group ID’s

If you want to run apache virtual host with its own user and group privileges. This module will make apache to access web contents with webcontent’s owner privileges. To do that you need mpm-itk module. You can download mpm-itk module from http://repo.webtatic.com/yum/centos/5/x86_64

 

#wget http://repo.webtatic.com/yum/centos/5/x86_64/httpd-itk-2.2.19-1.w5.x86_64.rpm

Install itk module in the server

#rpm -ivh httpd-itk-2.2.19-1.w5.x86_64.rpm

After installing stop apache service

#/etc/init.d/httpd stop

Then add the following line in /etc/sysconfig/httpd

HTTPD=/usr/sbin/httpd.itk

Then edit httpd.conf file and make changes to the domain’s Virtual host
entry as below

    ServerName example.com
    DocumentRoot /path/to/web/root

    AssignUserId username groupname

After adding start apache services

#/etc/init.d/httpd start

then change ownership of the web path by following command

#chown username:groupname /path/to/webroot
#chmod 710 /path/to/webroot
ls -al /path/to/webroot
drwx--x--- /path/to/webroot

That is it. Now apache will access your website contents with your own username and group name.

Reference: http://www.webtatic.com/packages/httpd-itk/

 

Thank you for viewing helpinlinux.com

 

Leave a Reply

Protected by WP Anti Spam