Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

PHP-FPM - vesta creates different backend ports for different sites?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
flasher4401
Posts: 3
Joined: Wed Mar 23, 2016 6:43 pm

PHP-FPM - vesta creates different backend ports for different sites?
  • Quote

Post by flasher4401 » Wed Mar 23, 2016 7:13 pm

Hi!

First of all some infos about my system:
Debian 8, VestaCP (Nginx + PHP-FPM, no Apache)

I thought about adding multi-php support (php7 for some of my sites) with the help of templates. The idea was to simply set different ports for different version (e.g. php5 - 9000, php7 - 9001). I'm sure that would work just fine but that's not what i'm asking for.


I discovered that vesta uses php-fpm "backend" templates

Code: Select all

found at: /usr/local/vesta/data/templates/web/php5-fpm
and inside the default.tpl you find the directive:

Code: Select all

listen = 127.0.0.1:%backend_port%
So i wanted to search for the setting "backend_port". I assumed it would be somewhere inside the vesta folder, set to the standard port 9000. I wasn't able to find it in a config file, but i could find it in a piece of source code. %backend_port% gets "calculated" everytime it is needed by the count of the config files inside the $pool folder. So i went on the search for the $pool folder...

Code: Select all

found at:  /etc/php5/fpm/pool.d
Inside the pool.d folder are config files for all of my sites. Each config file was created by filling the template, so each file has a listen directive like

Code: Select all

listen = 127.0.0.1:port
Each site has a different port starting at 9000, going up (e.g. 9001, 9002, 9003, ...).
Why can't they all just use the same port?

I consider changing the template from

Code: Select all

listen = 127.0.0.1:%backend_port%
to

Code: Select all

listen = 127.0.0.1:9000
-flasher
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: PHP-FPM - vesta creates different backend ports for different sites?
  • Quote

Post by skamasle » Wed Mar 23, 2016 7:25 pm

VestaCP use sockets or ports, but use a diferent port for every site,

site1.com port 9001
site2.com port 9002

If you what it owrking you need to run php5.5 on port 9000, php 7 onport 7000, edit template, edit some functions onvesta core and then it may work, so php 5, asign 900x and php 7 1000x or something like that.

So for take ports vesta scan pool.d directory and check if port is inuse or not, is not used then asign to site.

Im working on php selector forn nginx also :)
Top

flasher4401
Posts: 3
Joined: Wed Mar 23, 2016 6:43 pm

Re: PHP-FPM - vesta creates different backend ports for different sites?
  • Quote

Post by flasher4401 » Wed Mar 23, 2016 7:29 pm

Yeah, but why does it use different ports? Can't it just use the same port for each site? PHP-FPM listens on port 9000, why does it have to listen also on port 9001, 9002, ..., i mean its the same program behind these ports?
Top

skamasle
Collaborator
Posts: 592
Joined: Mon Feb 29, 2016 6:36 pm

Re: PHP-FPM - vesta creates different backend ports for different sites?
  • Quote

Post by skamasle » Wed Mar 23, 2016 8:19 pm

You need connect to direrent ports for better compatibility so, each user can run php-fpm instance, if not all users run on same instance and is a security problem and www-data own all files.
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password