suPHP setting user/group to virtual host and using docroot

故事扮演 提交于 2019-12-24 00:32:01

问题


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 admin@domain.com
    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

回答1:


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




回答2:


I add the following four lines to my vhost definitions. Line two is relevant to your question.

suPHP_Engine on
suPHP_UserGroup vhost_owner vhost_group 
suPHP_AddHandler x-httpd-php
AddHandler x-httpd-php .php .php3 .php4 .php5


来源:https://stackoverflow.com/questions/9263019/suphp-setting-user-group-to-virtual-host-and-using-docroot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!