Connect to unix:/var/run/php5-fpm.sock failed. What is wrong with my setup?

前端 未结 1 692
南旧
南旧 2021-01-31 10:25

I have a 2GB VPS on DigitalOcean and I am hosting WordPress 3.9.1 under Debian 7 with NGINX, php-fpm and unix socket.

It was working perfectly until last week it started

相关标签:
1条回答
  • 2021-01-31 11:13

    The first problem is you are specifying 100 max_children, that is awfully high for 2GB. I would drop it to 25 children. See my post here on how to optimise your php-fpm configuration for your setup:

    WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning

    Also, using unix sockets is slightly faster since it provides you direct network access without any TCP/IP overhead. On the down side, it is not as scalable as TCP/IP. Nginx will throw 502 errors when the sockets have been depleted. In such a case you can either tweak the OS settings to accommodate the larger connection pool or just switch to switch to TCP/IP.

    In your fastcgi conf change:

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    

    to:

    fastcgi_pass 127.0.0.1:9000;
    

    Note that port 9000 is the default port set in php-fpm, if you have changed php-fpm to listen on another port then swap 9000 with that value. Make sure you restart both php-fpm and nginx.

    Now, if after all of this, you still cannot get it to work and free -m returns high memory usage, then it is time to add more ram to your server.

    0 讨论(0)
提交回复
热议问题