suPHP setting user/group to virtual host and using docroot

Eli picture Eli · Feb 13, 2012 · Viewed 9.1k times · Source

I am trying to get suPHP working, i followed tutorials and seem to have it installed correctly.

now my issue is this

1) i set docroot in the suphp.conf file, but its set to /var/www by default. The problem I have with this is that my domains are stored under another directory as well. So for instance i have my subdomains in one directory and my regular domains in another. So I get an error thrown to my browser telling me that a domain is resolving to a directory not in the configuration.

2) I would like to know how to use suPHP_UserGroup to set the user/group of a specific domain set under my VirtualHost configuration.

This is an example VirtualHost that I have to better show my issues.

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerAlias mail.domain.com
    DocumentRoot /web/users/domain.com/subdomains/mail/webmail

    <IfModule mod_suphp.c>
        suPHP_UserGroup mail mail
    </IfModule>

    <Directory "/web/users/domain.com/subdomains/mail/webmail">
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>
</VirtualHost>

When I reload apache I get an error:

Invalid command 'suPHP_UserGroup', perhaps misspelled or defined by a module not included in the server configuration

I configured suPHP with this:

./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=owner --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes

Answer

Shylo Hana picture Shylo Hana · Nov 26, 2013

http://www.suphp.org/DocumentationView.html?file=apache/CONFIG

suPHP_UserGroup (expects user- and groupname)

  • Only supported when compiled with setid-mode "force" or "paranoid" * Specify the user- and groupname to run PHP-scripts with. This setting can only be used within a or context. Example: suPHP_UserGroup foouser bargroup

    ./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=paranoid --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes