Page 1 of 1

apache + php-fpm works but no backend template in gui

Posted: Fri Mar 04, 2016 8:49 pm
by Clouseau
I have modified install script to install apache and php-fpm successfully. I have manually created pools and add my own apache template and it works. So does webmail and phpmyadmin, with seperate php-fpm pool created for (admin) user. And now I can use Apache new mpm-event with php-fpm which is nice. mpm-event heavily outperforms prefork and with php-fpm it is working very good and fast. It would be nice if this was added as an option because it isn't that complicate to implement and it would be great to have an option to run apache with php-fpm.

Only thing that I didn't manage to get working is backend template option shown in Vesta gui so I can add those php-fpm pools through Vesta. Can someone help with the following? Where to look and what to modifiy. Is it even possible without heavy modifying the code?

Re: apache + php-fpm works but no backend template in gui

Posted: Fri Mar 04, 2016 9:57 pm
by skamasle
What errors you get ?

Re: apache + php-fpm works but no backend template in gui

Posted: Sat Mar 05, 2016 3:49 pm
by Clouseau
I added WEB_BACKEND='php-fpm' and there were no templates available in GUI under WEB templates, drop down was empty. Backend template section is missing. I run: v-list-web-templates and it show error:
ls: cannot access /usr/local/vesta/data/templates/web/apache/php-fpm/: No such file or directory
Templates
----------

So I added symlinks in /usr/local/vesta/data/templates/web/:
apache -> httpd/
And in httpd I added:
php-fpm -> ../httpd/

And I got web templates in Vesta GUI shown. But backend template option is not shown. Probably due to some "if then else" in Vesta panel code.

This shows good: v-list-web-templates-backend
Templates
----------
default
no-php
socket

I do not see any errors in /var/log/vesta/*

Re: apache + php-fpm works but no backend template in gui

Posted: Sat Mar 05, 2016 7:15 pm
by skamasle
You need add 3 files here

Code: Select all

/usr/local/vesta/data/templates/web/httpd/
.sh
.tpl
.stpl

If you dont add that 3 files vesta dont show nothing on menu.

Re: apache + php-fpm works but no backend template in gui

Posted: Sun Mar 06, 2016 6:05 pm
by Clouseau
I added all the templates from httpd directory to apache and Web templates are shown. But there is no "Backend template" section in GUI so I cannot select any of php-fpm templates, there is no drop down to select anything.

Also adding backend through CLI works: "v-add-web-domain-backend admin test.com socket" this creates php-fpm pool. The problem is there is no Backup template secion in GUI. There must be some hardcoded check if there is nginx set for web_system or something. This is my vesta.conf:

WEB_SYSTEM='apache'
WEB_RGROUPS='apache'
WEB_PORT='80'
WEB_SSL_PORT='443'
WEB_SSL='mod_ssl'
WEB_BACKEND='php-fpm'
STATS_SYSTEM='webalizer,awstats'
FTP_SYSTEM='vsftpd'
DNS_SYSTEM='named'
MAIL_SYSTEM='exim'
ANTIVIRUS_SYSTEM='clamav'
ANTISPAM_SYSTEM='spamassassin'
IMAP_SYSTEM='dovecot'
CRON_SYSTEM='crond'
BACKUP_SYSTEM='local'
LANGUAGE='en'
VERSION='0.9.8'
DB_SYSTEM='mysql'

Re: apache + php-fpm works but no backend template in gui

Posted: Sun Mar 06, 2016 7:04 pm
by Clouseau
I have to comment this in /usr/local/vesta/web/edit/web/index.php:

// List backend templates
//if (!empty($_SESSION['WEB_BACKEND'])) {
exec (VESTA_CMD."v-list-web-templates-backend json", $output, $return_var);
$backend_templates = json_decode(implode('', $output), true);
unset($output);
//}

Do you have an idea why SESSION variable WEB_BACKEND is not set?

Re: apache + php-fpm works but no backend template in gui

Posted: Sun Mar 06, 2016 9:43 pm
by Clouseau
Ok, I fixed it. It just need to log out and to log in to set new session vars :)