Page 1 of 1

Multiple PHP-FPM + Apache2 for VestaCP

Posted: Thu Jul 27, 2017 11:14 am
by Lesiu
I have Debian 8.8. Fresh install. VestaCP 0.9.8-17. I'am able to install multiple versions of PHP (5.6, 7.0, 7.1) with OpCache and they run as FastCGI (mod_fcgid). So I have 3 additional templates for Apache2. If anyone needs them - let me know and I will provide exact how to. PHP's run as FastCGI work fine, no problems with privileges.

However I wanted to install PHP-FPM version. So right now I have multiple versions of PHP (5.6, 7.0, 7.1) with appropriate templates. PHP files execute fine and phpinfo(); shows FPM/FastCGI. But I have problems with privileges/ownership the same as with HHVM. After I installed PHP-FPM the processes are run by www-data, not by admin. So I can't upload any files. I know that chmod -R www-data:www-data would help, but I still want to have access to these files via FTP as admin user. So I need to run all those PHP-FPM processes as admin user. How to do it? How to make it work after reboot?

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Thu Jul 27, 2017 12:17 pm
by Lesiu
Never mind. I did it. I had to create pools for user admin.

BTW. I'm preparing a comprehensive tutorial based on Debian 8 (jesse) and VestaCP. It contains:
- root password change
- SSH port change
- newer OpenSSL (1.0.2)
- newer fail2ban (0.9.7)
- nginx with newer OpenSSL (HTTP/2 support with ALPN support) (with template)
- HHVM (with template)
- PHP 5.6, PHP 7.0, PHP 7.1 run as FastCGI (with templates)
- PHP 5.6, PHP 7.0, PHP 7.1 run as PHP-FPM (with templates)
- MariaDB instead of MySQL (probably)
- newer Apache2 (probably)
- CSF (probably)

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Wed Jul 18, 2018 4:14 pm
by hassaan
Lesiu wrote:
Thu Jul 27, 2017 12:17 pm
Never mind. I did it. I had to create pools for user admin.

BTW. I'm preparing a comprehensive tutorial based on Debian 8 (jesse) and VestaCP. It contains:
- root password change
- SSH port change
- newer OpenSSL (1.0.2)
- newer fail2ban (0.9.7)
- nginx with newer OpenSSL (HTTP/2 support with ALPN support) (with template)
- HHVM (with template)
- PHP 5.6, PHP 7.0, PHP 7.1 run as FastCGI (with templates)
- PHP 5.6, PHP 7.0, PHP 7.1 run as PHP-FPM (with templates)
- MariaDB instead of MySQL (probably)
- newer Apache2 (probably)
- CSF (probably)

Can you please share this one with us?

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Fri Jul 20, 2018 12:43 pm
by mp2017
yes! please) .. this guide is very needed.
thank you

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Sat Sep 08, 2018 12:43 pm
by tamerhassan
coming soon? at least these two I'm very much interested to see with latest vestacp:
- nginx with newer OpenSSL (HTTP/2 support with ALPN support) (with template)
- PHP 5.6, PHP 7.0, PHP 7.1 run as PHP-FPM (with templates)

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Mon Feb 04, 2019 8:29 pm
by Lesiu
https://www.lesiu.eu/konfiguracja-serwe ... nel-vesta/

Comprehensive tutorial based on Debian 9 Stretch. Several PHP versions (7.0, 7.1, 7.2 and 7.3). Every of them working as fcgid and PHP-FPM as well (you can choose per website). You can also choose between original MySQL and Percona Server (version 8).

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Mon Feb 11, 2019 5:18 pm
by Felix
Lesiu wrote:
Mon Feb 04, 2019 8:29 pm
https://www.lesiu.eu/konfiguracja-serwe ... nel-vesta/

Comprehensive tutorial based on Debian 9 Stretch. Several PHP versions (7.0, 7.1, 7.2 and 7.3). Every of them working as fcgid and PHP-FPM as well (you can choose per website). You can also choose between original MySQL and Percona Server (version 8).
Hey Lesiu! Thank you for the tutorial, which looks nice and promising. Can't wait to try it on a new server. Quick questions for now:
1. Would you consider moving your code to Github or other version control system?
2. Do you think VESTA updates might break your code or cause other problems?

Re: Multiple PHP-FPM + Apache2 for VestaCP

Posted: Wed Feb 13, 2019 9:49 am
by Lesiu
Hey Felix. I already know there must be a quick fix applied if you choose Percona Server (version 8) as creating user and granting privileges is a bit different in MySQL 8. It will work, but roundcube user is not created, so roundcube won't work out of the box. It's very simple to fix this as roundcube database is being created successfully.

1. I have no knowledge regarding Github.
2. There may be some minor issues after update but they are related to php-fpm and new users only. My version is just a modified installer with several new templates. So templates won't be overwritten, services won't be removed. A minor issue is related to creation of new spool for php-fpm. I will write a short how-to fix. It's just one line of code to be added to /bin/v-add-user and one line to /bin/v-delete-user - there must be a line that executes additional /bin/v-add-user-fpm and /bin/v-delete-user-fpm. That's it.

Some other enhancements may be done, that I recommend. I have rainloop as an alternative to roundcube. I also have squid proxy server configured as elite proxy, but they are not related to vesta.

There is also one thing to be modified if you want to use longer database names. Vesta limits database names when being created to 16 characters. However MySQL 8 and probably 5.7 allow 32 characters. And I use those bigger limit, because remember that vesta adds user_ prefix to every database name, so if you have user michael, then you have michael_ prefix and you have only 8 characters left. That's not enough for me.