rwdev
By:
rwdev

504 Wordpress Errors with Nginx and PHP5-FPM

December 21, 2017 194 views
WordPress Nginx PHP Ubuntu

My Wordpress blog has been getting 504 errors practically every time I try to load a page in the admin panel or on the site. I used to get those occasionally but now it's happening all the time.

My plan has 1 CPU and 1GB memory. I'm running the blog on an Ubuntu 14.04 server with nginx, mysql, and php5-fpm.

The nginx error logs show:

[error] 4405#0: *191 upstream timed out (110: Connection timed out) while reading response header from upstream, client: w.x.y.z, server: a.b.c.d, request: "GET /page-name/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "my.domain", referrer: "http://my.domain/blog/"

This is my site's nginx conf file:

server {
    listen 80;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name w.x.y.z;

    location / {
          try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

This is my php5 pool.d/www.conf file:

[www]

user = www-data
group = www-data

listen = 127.0.0.1:9000

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

pm = dynamic

pm.max_children = 5

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 3

pm.max_requests = 200

request_terminate_timeout = 30s

chdir = /

Be the first one to answer this question.