Plesk 11.5 PHP-FPM error: server reached max_children setting (5), consider raising it - nginx

Does anyone know how I might solve this particular error in a multi-domain VHOST Plesk environment?
server reached max_children setting (5), consider raising it
There are a number of domains listed in the /etc/php-fpm.d/ folder, which contain the following settings:
pm.max_children = 5
pm.process_idle_timeout = 10s
; Following pm.* options are used only when 'pm = dynamic'
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 5
Is there a way to change this globally? Each conf file comes with a warning not to alter the file directly since the changes will be overwritten when the files are re-generated.
ANy ideas?

In all each php-fpm config files there is a notes from Parallels:
To override pool configuration options, specify them in
[php-fpm-pool-settings] section of
/var/www/vhosts/system/domain.tld/conf/php.ini file.
As I see there is no way to tune this setting by plesk utilities or from GUI.
There is template:
/usr/local/psa/admin/conf/templates/default/domain/service/fpm.php
but this template is for nginx, not for php-fpm configs.

Related

How to update the log level of passenger?

I have been trying to figure out how to set the passenger_log_level to 7 in passenger+nginx configuration on Ubuntu 18.04 server. I tried to set it inside Nginx configuration for the server block but it is not allowed there. Please guide me how can I update the log level
To update the log level of the Passenger in Nginx + Passenger configuration, set
passenger_log_level Number(0-7);
in the http context.
On Ubuntu, open the /etc/nginx/nginx.conf file and look for http context and set the
passenger_log_level 7;

nginx+php "The connection was reset" on file upload

I get an error that says "The connection was reset" immediately when I upload a file over a certain size, I think it's over around 4MB.
My web server is running on nginx, I tried set client_max_body_size 1G or even setting to 0, no success.
I'd be glad to hear a solution.
Thanks!
I just had to restart the nginx service by using sudo service nginx restart and it solved itself!
In my case, the file was bigger than the allowed size by NGINX in the setting "client_max_body_size". To change this setting open in your terminal the file /etc/nginx/nginx.conf and add the following inside the http section:
http {
...
client_max_body_size 128m; #Any desired size in MB
...
}
In nginx versions from 1.0 and above, this setting is not included by default in the nginx.conf file.

Alternate max_post_size and upload_max_filesize for different subdomains and/or directories php.ini nginx fastcgi php-fpm

I have nginx and php5-fpm working wonderfully, and www.mysite.com, this.mysite.com, and that.mysite.com all go to different directories elegantly. I have been working on a site for uploading files. I'd like the maximum file size to be 10 GB. For this to work, I have to tell php.ini that max_post_size and upload_max_filesize are 10240 MB instead of the default 2 MB.
I am well aware of the security implications. I would therefore like those php.ini values of 10240 MB to apply ONLY to one or both of:
upload.mysite.com
and/or
www.mysite.com/upload
One option is to also install Apache to listen on a different port, do some redirect/rewrite magic, and have mod_php's php.ini file with the 10240 MB values handle only the uploads site. I'd prefer to not do that.
WITHOUT having a separate web server handle requests to my upload page, how can I accomplish this in a single instance of nginx?
Use client_max_body_size and set it to the desired value in your server blocks. Nginx will directly drop the handling of the request if the request body exceeds the size specified in this directive. Please note that you won't get any POST submitted in that case.
With php-fpm you can have several pools running, one for each website.
Then you can alter any php.ini setting inside the pool configuration (but be carefull, you cannot use MB or G shortcuts), using this syntax inside the pool:
; UPLOAD
php_admin_flag[file_uploads] =1
php_admin_value[upload_tmp_dir]="/some/path/var/tmp"
;Maximum allowed size for uploaded files. 10240MB *1024 *1024 -> 10737418240
php_value[upload_max_filesize] ="10737418240"
php_admin_value[max_input_time] = (...)
php_admin_value[post_max_size] (...)
This is really near the available syntax for Apache virtualhosts. PHP configuration has never been stuck in php.ini files.
As you can see you can use php_value or php_admin_value, the big difference is that when using php_value the setting can later be altered by the application, using ini_set command. So you could use a low value for upload_max_filesize and alter it in the application only on the upload script.

php-fpm wont load php.ini settings

I'm using nginx and php-fpm.
My phpinfo page says php is loading the php.ini file from /etc/php5/fpm/php.ini, I tried updating that file then running
sudo service php-fpm reload
But php still uses old settings, phpinfo shows old values as if I didn't modify anything.
I tried restarting php-fpm and even restarting my computer but it still doesn't work, it just wont load the new php.ini values...
You may want to check your FPM Pool Configuration. You can also set php.ini settings there which in my opinion is a better place when using FPM.
You'll find something like this at the end of your FPM Pool Configuration:
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr/local)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
Now you can add random configuration changes such as:
php_flag[display_errors] = on
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 128M
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i
Of course, be certain that you restart FPM after you change the configuration so that it takes effect.

Internal Server Error in nginx when uploading bigger files greater than 15MB

I am using parallel plesk 11 , and there is service of nginx as reverse proxy server and i am using that , Whenever i try to upload the file size greater than 15MB it gives internal server error. I am not able to find out the problem that is causing this issue.
I am providing the php.ini settings. After checking do tell me any solution, its very urgent to know it is affecting my server services.
I am running php as fastcgi and
settings are
post_max_size 200M
upload_max_filesize 450M
memeory_limit 32M
safe_mode on
The error happened due to httpmaxrequest length error . Which was due to mod_fcgid of apache,
so i changed the fcgid.conf present in /etc/apache2/mods-available/fcgid.conf
Also this file has to be changed for proper working of uploading in parallel plesk.
MaxRequestLen in /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
And After that reconfigure the domain Reconfigure domains: /usr/local/psa/admin/bin/httpdmng --reconfigure-all
Restart Both nginx and apache
service nginx restart
service apache2 restart
Than everything will work fine , Uploading this way can be done. And this is major problem which happens in ubuntu 10.10 running parallel plesk 11.

Resources