Plesk10 with PHP5 + suPHP + Apache2

Just so I remember for when setting up another Plesk10 box with suPHP:

Plesk keeps all client sites under /var/www/vhosts/ but hosts other services (like webmail) through /usr/share/ 

I’d like to run all .php files under /var/www/vhosts/ through suPHP, while keeping .php files like webmail running through the normal apache mod_php5. Here’s a rough process:

 

# apt-get install ´╗┐libapache2-mod-suphp
# a2enmod suphp
# a2enmod php5
# vi /etc/suphp/suphp.conf

[global] logfile=/var/log/suphp/suphp.log ;Loglevel loglevel=warn webserver_user=www-data docroot=/var/www allow_file_group_writeable=true allow_file_others_writeable=true allow_directory_group_writeable=true allow_directory_others_writeable=true check_vhost_docroot=true errors_to_browser=false env_path=/bin:/usr/bin umask=0077 min_uid=100 min_gid=33 [handlers] application/x-httpd-php="php:/usr/bin/php-cgi" application/x-httpd-suphp="php:/usr/bin/php-cgi" x-suphp-cgi="execute:!self"

# vi /etc/apache2/mods-enabled/suphp.conf

<IfModule mod_suphp.c>
    <Directory /var/www/vhosts>
        suPHP_Engine on
        suPHP_AddHandler application/x-httpd-suphp
        <FilesMatch ".ph(p3?|tml)$">
            SetHandler application/x-httpd-suphp
        </FilesMatch>
    </Directory>
    <Directory /usr/share>
        suPHP_Engine off
    </Directory>
</IfModule>
# /etc/init.d/apache2 restart

I also removed the AddType application/x-httpd-php from /etc/apache2/apache2.conf

(my main reason for running suPHP is so clients don’t need to chmod their own files/folder in order for them to have write access from php scripts, and so things like auto generated thumbnails aren’t created with user www-data and can be easily access via FTP/SCP as they are the same user)

Leave a Reply

Your email address will not be published. Required fields are marked *