Author Topic: webpages is halted by the combination of NGINX and PHP-FRM  (Read 2859 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
webpages is halted by the combination of NGINX and PHP-FRM
« on: June 21, 2023, 03:01:34 AM »
Hello everyone! I'm currently utilizing NGINX alongside PHP-FPM 7.4. Recently, I've encountered an issue where certain pages become unresponsive at random intervals. The only solution I've found so far is to either reboot the server or restart the Apache service. I'm curious if anyone else has experienced this problem and if there are any known fixes or workarounds available. Your insights would be greatly appreciated!





Offline
****
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #1 on: June 22, 2023, 03:10:46 AM »
Are your pages database driven or static? Is the web page managed by a CMS like WordPress? Have you tuned the process timeouts in the vhost conf? Anything special done to tune your php-fpm 7.4? Is it just under a specific user account, or does it affect all users on the server?

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #2 on: June 22, 2023, 11:33:30 PM »
Are your pages database driven or static? Is the web page managed by a CMS like WordPress? Have you tuned the process timeouts in the vhost conf? Anything special done to tune your php-fpm 7.4? Is it just under a specific user account, or does it affect all users on the server?

it affects all users .. most are wordpress with local db, with one of them being static fetching currency from other website.. even that stops working .. nothing special to tune php-frm .. see below for the php.ini configuration ..

[PHP]
engine = On
short_open_tag = On
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
zend.exception_ignore_args = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 1G
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
cgi.fix_pathinfo=1
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 2
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[imap]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
mail.log = /usr/local/apache/logs/phpmail.log
mail.log = /usr/local/apache/logs/phpmail.log
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.cookie_samesite =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[dba]
[opcache]
[curl]
[openssl]
[ffi]

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #3 on: June 22, 2023, 11:36:04 PM »
Are your pages database driven or static? Is the web page managed by a CMS like WordPress? Have you tuned the process timeouts in the vhost conf? Anything special done to tune your php-fpm 7.4? Is it just under a specific user account, or does it affect all users on the server?

it affects all users .. most are wordpress with local db, with one of them being static fetching currency from other website.. even that stops working .. nothing special to tune php-frm .. also checking services are all running ..


 see below for the php.ini configuration ..

[PHP]
engine = On
short_open_tag = On
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
zend.exception_ignore_args = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 1G
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
cgi.fix_pathinfo=1
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 2
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[imap]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
mail.log = /usr/local/apache/logs/phpmail.log
mail.log = /usr/local/apache/logs/phpmail.log
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.cookie_samesite =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[dba]
[opcache]
[curl]
[openssl]
[ffi]

Offline
****
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #4 on: June 24, 2023, 03:45:59 AM »
Are your nginx conf files tuned according to the WP "recipe" from Nginx.com?
https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
In your nginx vhost conf, do you do any buffer & timeout tuning? This is one I use with a Drupal site, so YMMV:
Code: [Select]
        fastcgi_pass unix:/opt/alt/php-fpm74/usr/var/sockets/user.sock;
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        try_files $fastcgi_script_name =404;
        fastcgi_index    update.php;
        include              fastcgi_params;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        # Block httpoxy attacks. See https://httpoxy.org/.
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
    }

Anything special in your php-fpm7.4 user.conf?
Code: [Select]
[user]
listen = /opt/alt/php-fpm74/usr/var/sockets/user.sock
listen.allowed_clients = 127.0.0.1

;listen.owner = "user"
listen.group = "nobody"
listen.mode = 0660
user = "user"
group = "user"

;request_slowlog_timeout = 15s
;slowlog = /opt/alt/php-fpm74/usr/var/log/php-fpm-slowlog-user.log

pm = ondemand
pm.max_children = 4
pm.max_requests = 4000
pm.process_idle_timeout = 15s

;listen.backlog = -1
;request_terminate_timeout = 0s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /home/user/tmp
env[TMPDIR] = /home/user/tmp
env[TEMP] = /home/user/tmp
env[PATH] = /usr/local/bin:/usr/bin:/bin

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #5 on: June 24, 2023, 04:05:27 AM »
thanks for that ill check it out, for me, it happens randomly, then i get alerts from uptime monitor that the sites go down .. is there any logs also to check for what could be causing it ?

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #6 on: June 24, 2023, 04:57:54 AM »
my php-fpm7.4 user.conf pretty much matches yours exactly, for the other ngnix config i couldnt find the same, where it referenced fastcgi

Offline
****
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #7 on: June 24, 2023, 03:39:14 PM »
I added in the fastcgi tuning specifically for the Drupal installation, but some of the principles apply to WP sites, particularly loaded ones. You need to look for the block in your Nginx vhost conf that includes your php-fpm socket:
Code: [Select]
/opt/alt/php-fpm74/usr/var/sockets/user.sockAnd that's where you put in the fastcgi tuning directives (buffers, timeouts).

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #8 on: June 26, 2023, 11:17:53 PM »
is that an additional module that needs to be enabled? i cant find it anywhere

Offline
****
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #9 on: June 27, 2023, 12:14:58 AM »
You mean you're not seeing the fastcgi_buffer lines in your Nginx vhost conf? It's because I added them in for tuning purposes.
Code: [Select]
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #10 on: June 27, 2023, 12:27:18 AM »
hey, not seeing any lines related to fastcgi

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #11 on: July 05, 2023, 09:21:28 AM »
Just had a single website go off-line now, which which logs can I check? Tried to restart Apache no luck. Restart reverse ngix no good. Fix permissions no good still.. would like to see at a debug level what's causing this problem and why the server didn't auto correct it as we have this feature enabled

Offline
****
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #12 on: July 06, 2023, 02:14:58 AM »
You should look at the last lines of that website's log files:

access log: /usr/local/apache/domlogs/yourdomain.com.log
error log: /usr/local/apache/domlogs/yourdomain.com.error.log

Should give you a pretty good clue as to what's going wrong.

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #13 on: July 06, 2023, 03:08:17 AM »
Restarted the server and still didn't work. Was only able to bring it back by resetting the mysql password.

Offline
*
Re: webpages is halted by the combination of NGINX and PHP-FRM
« Reply #14 on: July 06, 2023, 03:41:42 AM »
Restarted the server and still didn't work. Was only able to bring it back by resetting the mysql password for the website in question, which seems unusual .. any idea what you think might have caused it?