L
ledj
Guest
Hello all
Couldn't wait for Plesk 9, 10 or 11...
Here's a python script (with a shell based call script) which can be put into the physical hosting event handlers and configures Plesk domains for user based vhost automatically.
The script is tested with Plesk 8.2, 8.3, 8.4 and 8.6!
Short description of what User Based Vhost script can do:
- Every new domain created will have the owner of the files in http(s)docs folder of a domain/subdomain as the user of the running webserver processes (php-cgi process). This will eliminate the problems with different permissions of the Plesk FTP user and webserver user, which can really annoy some users.
- Subdomains with separate FTP users are also supported. You can actually run a subdomain with a different webserver user than the domain does.
- Every domain can have it's own php.ini (subdomains uses the domain php.ini).
- It's possible to configure some important areas in php.ini and the php wrapper script with ini-style configuration.
Requirements:
Plesk 8.X on Centos 5.X
Critical requirements:
Plesk FastCGI support (mod_fcgid), Plesk API
Python packages: python-curl and PyXML
PHP compiled with --enable-fastcgi and --enable-force-cgi-redirect
Install:
This should be configured in the Plesk Event Manager:
Physical hosting created highest (100) root /root/bin/user_based_vhost/callscript.sh create
Physical hosting deleted highest (100) root /root/bin/user_based_vhost/callscript.sh delete
Physical hosting updated highest (100) root /root/bin/user_based_vhost/callscript.sh update
Subdomain created highest (100) root /root/bin/user_based_vhost/callscript.sh create
Subdomain updated highest (100) root /root/bin/user_based_vhost/callscript.sh update
Disable PHP support (mod_php) for the domain and enable FastCGI support in the Plesk webinterface.
/etc/httpd/conf.d/php.conf should only contain the line (uncomment the other lines):
LoadModule php5_module modules/libphp5.so
Add this to /etc/httpd/conf.d/fcgid.conf:
PHP_Fix_Pathinfo_Enable 1
Configuration:
Settings: /root/bin/user_based_vhost/conf/default.ini
Templates: /root/bin/user_based_vhost/tmpl
Last notice:
I haven't tested the script in other paths than /root/bin/user_based_vhost/ so it may break if you do not place it in there. And Horde webmail might break also if you haven't configured properly. Or maybe I've forgot to tell you something...
You shouldn't use the script in a production environment unless you know what you are doing. I use it in production, but it would be nice to have others test it also.
************************************************************************************************
NOTE THAT USING PHP THROUGH FASTCGI WILL SPAWN A LOT OF PHP-CGI PROCESSES ON VERY BUSY WEBSITES. WORST CASE YOUR SERVER WILL CRASH IF THE SERVER IS SHORT ON MEMORY.
************************************************************************************************
Thanks.
File attached.
Couldn't wait for Plesk 9, 10 or 11...
Here's a python script (with a shell based call script) which can be put into the physical hosting event handlers and configures Plesk domains for user based vhost automatically.
The script is tested with Plesk 8.2, 8.3, 8.4 and 8.6!
Short description of what User Based Vhost script can do:
- Every new domain created will have the owner of the files in http(s)docs folder of a domain/subdomain as the user of the running webserver processes (php-cgi process). This will eliminate the problems with different permissions of the Plesk FTP user and webserver user, which can really annoy some users.
- Subdomains with separate FTP users are also supported. You can actually run a subdomain with a different webserver user than the domain does.
- Every domain can have it's own php.ini (subdomains uses the domain php.ini).
- It's possible to configure some important areas in php.ini and the php wrapper script with ini-style configuration.
Requirements:
Plesk 8.X on Centos 5.X
Critical requirements:
Plesk FastCGI support (mod_fcgid), Plesk API
Python packages: python-curl and PyXML
PHP compiled with --enable-fastcgi and --enable-force-cgi-redirect
Install:
This should be configured in the Plesk Event Manager:
Physical hosting created highest (100) root /root/bin/user_based_vhost/callscript.sh create
Physical hosting deleted highest (100) root /root/bin/user_based_vhost/callscript.sh delete
Physical hosting updated highest (100) root /root/bin/user_based_vhost/callscript.sh update
Subdomain created highest (100) root /root/bin/user_based_vhost/callscript.sh create
Subdomain updated highest (100) root /root/bin/user_based_vhost/callscript.sh update
Disable PHP support (mod_php) for the domain and enable FastCGI support in the Plesk webinterface.
/etc/httpd/conf.d/php.conf should only contain the line (uncomment the other lines):
LoadModule php5_module modules/libphp5.so
Add this to /etc/httpd/conf.d/fcgid.conf:
PHP_Fix_Pathinfo_Enable 1
Configuration:
Settings: /root/bin/user_based_vhost/conf/default.ini
Templates: /root/bin/user_based_vhost/tmpl
Last notice:
I haven't tested the script in other paths than /root/bin/user_based_vhost/ so it may break if you do not place it in there. And Horde webmail might break also if you haven't configured properly. Or maybe I've forgot to tell you something...
You shouldn't use the script in a production environment unless you know what you are doing. I use it in production, but it would be nice to have others test it also.
************************************************************************************************
NOTE THAT USING PHP THROUGH FASTCGI WILL SPAWN A LOT OF PHP-CGI PROCESSES ON VERY BUSY WEBSITES. WORST CASE YOUR SERVER WILL CRASH IF THE SERVER IS SHORT ON MEMORY.
************************************************************************************************
Thanks.
File attached.