• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Timeout of website using PHP-FPM application served by nginx

cipcip

Basic Pleskian
Hi guys,

I know that this was discussed over and over again.
I found this article here: Website on Plesk server is not accessible: 504 Gateway Time-out: The timeout specified has expired: [client 203.0.113.2:54693] AH01075: Error dispatching request to which I followed, but still not working.

My problem is as following:
- The website works for a certain amount of time;
- After it works for example 3-4-5 hours, it gets the error message in the logs: (70007)The timeout specified has expired: AH01075: Error dispatching request to : (polling)

Thank you,
Cristian
 
Hi

this might be a RAM error, please check with dmesg command for it.
also consider removal of NGINX as a walk around.

Noam
 
Hello Noam,

Thank you for your response.
I have also tried with PHP-FPM served by Apache, same issue.

For specs, I have a dedicated server with the following:
- AMD Opteron 3280 (8cores)
- 23.5 GB of ram
- 7.6GB of swap
- 1.8 TB of hdd

Thank you,
Cristian
 
Apache & nginx Settings -

Additional directives for HTTP,

<IfModule mod_fcgid.c>
FcgidIOTimeout 300
</IfModule>

Additional directives for HTTPS,

<IfModule mod_fcgid.c>
FcgidIOTimeout 300
</IfModule>

Additional nginx directives,

proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
 
Hello Noam,

Thank you for your response.
I have also tried with PHP-FPM served by Apache, same issue.

For specs, I have a dedicated server with the following:
- AMD Opteron 3280 (8cores)
- 23.5 GB of ram
- 7.6GB of swap
- 1.8 TB of hdd

Thank you,
Cristian

I would try what AusWeb wrote, but also it is recommended not to use swap.
have you tried to remove NGINX?
 
Hello Noam,

I have made the settings that AusWeb told me and if it is still doing the same thing, I will try to remove nginx.
The thing is that the issue is happening after 3-4-5 hours of a server reboot. Now the website is working as it should.
I do not know why, in time, it gives timeouts. Seems like the server is getting overused, but when looking at the server stats, it never goes pass 1.5gb - 2gb of ram and I have plenty...

Thanks,
Cristian
 
Hello Noam,

I have made the settings that AusWeb told me and if it is still doing the same thing, I will try to remove nginx.
The thing is that the issue is happening after 3-4-5 hours of a server reboot. Now the website is working as it should.
I do not know why, in time, it gives timeouts. Seems like the server is getting overused, but when looking at the server stats, it never goes pass 1.5gb - 2gb of ram and I have plenty...

Thanks,
Cristian
thats why i thought you should look at dmesg for "out of memory..." or "killed proccess..." messages,
i would remove swap and move server to apache only.

in my hosting environment all shared server doesn't have nginx...
 
Now i am getting another error...

This site can’t provide a secure connection

What I did:
- deactivated nginx - i saw that none of my websites were working without it, even though except for the one in cause, none of them was using fpm nginx
- rebooted server
- activated nginx
- rebooted server

How can I solve this now ?

THanks,
Cristian
 
how did you disabled it?
you probably have only stopped the service but NGINX still is the port 80 listener...
you need plesk to change port 80 to apache.
it should be done through: "Webserver Configurations Troubleshooter" or updates.
 
Hello Noam,

I removed nginx completely and rebooted the server and now the websites are back up. I will keep you posted if this issue will still continue.

Best regards,
Cristian
 
Hello,

It appears that I am still receiving the timeouts error messages...

Thanks,
Cristian
 
Hello,

From the logs in plesk I get: (70007)The timeout specified has expired: AH01075: Error dispatching request to : (polling)
I ran the dmesg command but I do not know how to interpret it since I never used it, I will google it to find more.

I do not understand why is needed to disable swap, there is plenty of ram memory available without reaching swap, also other websites are not affected, only this one. I am hosting 8 websites on this server.

Thanks,
Cristian
 
For dmesg related to memory:

dmesg | grep -i memory
[ 0.000000] Scanning 1 areas for low memory corruption
[ 0.000000] Early memory node ranges
[ 0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[ 0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009efff]
[ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000dffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000e0000-0x000fffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdcc80000-0xdcc87fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdcc88000-0xdccd7fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdccdf000-0xdd539fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd53a000-0xdd542fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd543000-0xdd55ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd560000-0xdd560fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd561000-0xdd57dfff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd57e000-0xdd57efff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd57f000-0xdd592fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd593000-0xdd598fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd599000-0xdd5f4fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdd5f5000-0xdd7f7fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xddbed000-0xdddf0fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xdde00000-0xfebfffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfec00000-0xfec00fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfec01000-0xfec0ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfec10000-0xfec10fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfec11000-0xfecfffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfed00000-0xfed00fff]
[ 0.000000] PM: Registered nosave memory: [mem 0xfed01000-0xff7fffff]
[ 0.000000] PM: Registered nosave memory: [mem 0xff800000-0xffffffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x100000000-0x100000fff]
[ 0.000000] AGP: Your BIOS doesn't leave an aperture memory hole
[ 0.000000] PM: Registered nosave memory: [mem 0xd4000000-0xd7ffffff]
[ 0.000000] Memory: 24506808K/25100444K available (12300K kernel code, 2481K rwdata, 4256K rodata, 2436K init, 2388K bss, 593636K reserved, 0K cma-reserved)
[ 0.049417] Freeing SMP alternatives memory: 36K
[ 0.249035] x86/mm: Memory block size: 128MB
[ 1.441872] Freeing initrd memory: 39180K
[ 1.447752] Scanning for low memory corruption every 60 seconds
[ 6.536643] Freeing unused kernel image memory: 2436K
[ 6.601811] Freeing unused kernel image memory: 2008K
[ 6.622236] Freeing unused kernel image memory: 1888K
[ 17.966646] [TTM] Zone kernel: Available graphics memory: 12309154 kiB
[ 17.966647] [TTM] Zone dma32: Available graphics memory: 2097152 kiB
[ 17.966673] [drm] radeon: 32M of VRAM memory ready
[ 17.966674] [drm] radeon: 512M of GTT memory ready.
 
I have removed nginx. I have also followed the tutorial and made the necessary settings, but no luck.
The website is custom coded by me.

Could it be because I have ~55 crons that are running under this domain ? They are not running all at the same time, they go throughout the day.
Half of them are running under the following pattern: 0 0,3,6,9,12,15,18,21 * * *
The other half under: 0 2,5,8,11,14,17,20,23 * * *

It is a news based site so I am pulling data from API and my website just displays it.
 
ok, that might be it regarding timeout settings,
paste this inside "apache & Nginx settings":
Additional directives for HTTP,
<IfModule mod_fcgid.c>
FcgidIOTimeout 300
</IfModule>

also raise the value in php settings of max execution time to 320
 
Thank you Noam, I just did the settings. Will let you know if everything is ok.

Thanks,
Cristian
 
Back
Top