Question

Nginx + PHP-FRM 7.4 Not stable work

Posted May 18, 2021 93 views
WordPress

Error log

2021/05/18 05:52:32 [error] 109667#109667: *5864 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 188.163.49.174, server: i-wp-dev.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/i-wp-dev.com.sock:", host: "i-wp-dev.com", referrer: "https://i-wp-dev.com/wp-admin/upload.php"
2021/05/18 05:52:32 [error] 109667#109667: *5865 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 188.163.49.174, server: i-wp-dev.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/i-wp-dev.com.sock:", host: "i-wp-dev.com", referrer: "https://i-wp-dev.com/wp-admin/upload.php"
2021/05/18 05:52:32 [error] 109667#109667: *5870 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 188.163.49.174, server: i-wp-dev.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/i-wp-dev.com.sock:", host: "i-wp-dev.com", referrer: "https://i-wp-dev.com/wp-admin/upload.php"
2021/05/18 05:52:32 [crit] 109667#109667: *5863 connect() to unix:/var/run/i-wp-dev.com.sock failed (2: No such file or directory) while connecting to upstream, client: 188.163.49.174, server: i-wp-dev.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/i-wp-dev.com.sock:", host: "i-wp-dev.com", referrer: "https://i-wp-dev.com/wp-admin/upload.php"
2021/05/18 05:52:32 [crit] 109667#109667: *5864 connect() to unix:/var/run/i-wp-dev.com.sock failed (2: No such file or directory) while connecting to upstream, client: 188.163.49.174, server: i-wp-dev.com, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/i-wp-dev.com.sock:", host: "i-wp-dev.com", referrer: "https://i-wp-dev.com/wp-admin/upload.php"

Server Settings


server {
    server_name i-wp-dev.com www.i-wp-dev.com  ;
    listen 159.65.125.4:443 ssl ;

    ssl_certificate "/var/www/httpd-cert/i-wp-dev.com_2021-05-17-09-12_39.crt";
    ssl_certificate_key "/var/www/httpd-cert/i-wp-dev.com_2021-05-17-09-12_39.key";

    charset utf-8;

    gzip on;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/css text/xml application/javascript text/plain application/json image/svg+xml image/x-icon;
    gzip_comp_level 1;

    set $root_path /var/www/i-wp-dev.com/data/www/i-wp-dev.com;
    root $root_path;
    disable_symlinks if_not_owner from=$root_path;

    location / {
        index index.php index.html;
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        proxy_read_timeout 3600;
        proxy_send_timeout 3600;

        fastcgi_send_timeout 3600s;
        fastcgi_read_timeout 3600s;
        fastcgi_pass unix:/var/run/i-wp-dev.com.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;

     }

    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpeg|avi|zip|gz|bz2|rar|swf|ico|7z|doc|docx|map|ogg|otf|pdf|tff|tif|txt|wav|webp|woff|woff2|xls|xlsx|xml)$ {
        try_files $uri $uri/ @fallback;
    }

    location @fallback {
        fastcgi_pass unix:/var/run/i-wp-dev.com.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }

    include "/etc/nginx/fastpanel2-sites/i-wp-dev.com/i-wp-dev.com.includes";
    include /etc/nginx/fastpanel2-includes/*.conf;


    error_log /var/www/i-wp-dev.com/data/logs/i-wp-dev.com-frontend.error.log;
    access_log off;
}


server {
    server_name i-wp-dev.com www.i-wp-dev.com  ;
    listen 159.65.125.4:80;
    return 301 https://$host$request_uri;

    error_log /var/www/i-wp-dev.com/data/logs/i-wp-dev.com-frontend.error.log;
    access_log off;
}

There is a fastpanel control panel,
The site constantly crashes with 502 or 504 errors
On a local machine with a docker container on Nginx + PHP-FRM, 7.4 everything works well

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @glazoknet,

It seems to me you are reaching your Droplet’s limits. Have you checked your CPU utilization or memory utilization?

It’s possible the Droplet is not able to coop with the traffic/requests your application receives and thus ending in killing some PHP-FPM requests which result in 502 or 504 Nginx errors.

Additionally, make sure to optimize your PHP-FPM configuration. PHP-FPM configuration can work wonders depending on how you configure it. The thing is, it’s hard to get spot on so you might need to go over some trial and error stuff before making it work as best as it can be.

Regards,
KFSys

  • the problem is that there is no load on the site, it has not even been indexed yet and I am working on it myself in the admin panel