apache & suexec & mod_fcgid & mod_userdir

Discussion in 'Server Operation' started by centurianii, Sep 9, 2012.

  1. centurianii

    centurianii New Member

    After following Falco's tutorial I managed to have working virtual hosts one per file.
    Now, I want to access a user's home from the following url: http://www.example.com/~john/info.php with the help of mod_userdir.
    Is this possible with suexec?

    Let's see how john is configured at: /etc/apache2/sites-available/
    Code:
    #default virtual host
    <VirtualHost *:80>
      ServerName www.john.example.com
      ServerAlias john.example.com
      ServerAdmin webmaster@john.example.com
      DocumentRoot /var/www/john/web/
      SuexecUserGroup john john
      <Directory /var/www/john/web/>
        Options +ExecCGI
        Options -Indexes
        AllowOverride All
        AddHandler fcgid-script .php
        #FCGIWrapper /var/www/php-fcgi-scripts/john/php-fcgi-starter .php
        FcgidWrapper /var/www/php-fcgi-scripts/john/php-fcgi-starter .php
        Order allow,deny
        Allow from all
      </Directory>
    
      # ErrorLog /var/log/apache2/error.log
      # CustomLog /var/log/apache2/access.log combined
      ServerSignature Off
    
    </VirtualHost>
    As you can see directive
    Code:
    SuexecUserGroup john john
    is indeed a problem but as Apache states (http://httpd.apache.org/docs/2.2/suexec.html#usage):
    "Requests that are processed by mod_userdir will call the suEXEC wrapper to execute CGI programs under the userid of the requested user directory."

    I tried to modify file john (after enabling mod_userdir) to work for any user as follows:
    Code:
    <VirtualHost *:80>
      ServerAlias *.example.com
      ServerAdmin webmaster@example.com
    
      ##################
      ### solution ###
      ##################
      #mod_userdir directives for requests: http://www.example.com/~user
      UserDir disabled root
      UserDir /var/www/*/web
    
      #reduntant if using requests: http://www.example.com/~user
      #SuexecUserGroup john john
      <Directory /var/www/*/web/>
        Options +ExecCGI
        Options -Indexes
        AllowOverride All
        AddHandler fcgid-script .php
        #move to .htaccess
        #FCGIWrapper /var/www/php-fcgi-scripts/*/php-fcgi-starter .php
        #FcgidWrapper /var/www/php-fcgi-scripts/*/php-fcgi-starter .php
        Order allow,deny
        Allow from all
      </Directory>
    
      # ErrorLog /var/log/apache2/error.log
      # CustomLog /var/log/apache2/access.log combined
      ServerSignature Off
    
    </VirtualHost>
    As you can see I also created a .htaccess file with the directive:
    Code:
    FcgidWrapper /var/www/php-fcgi-scripts/john/php-fcgi-starter .php
    (there is no meaning to keep * now in the path for wrapper script) but the result is for Apache to send the .php file info.php for download with no error logs!?

    Any idea how to achive this?
    Thanks.
     

Share This Page