Home  >  Article  >  Backend Development  >  Encountered a problem----connect() failed (111: Connection refused) while connecting to upstream solution

Encountered a problem----connect() failed (111: Connection refused) while connecting to upstream solution

WBOY
WBOYOriginal
2016-08-08 09:24:575471browse

When we start nginx, we may encounter the problem of connect() failed (111: Connection refused) while connecting to upstream.

Sometimes nginx runs normally, but you will find that there are still errors in the error log: connect() failed (111: Connection refused) while connecting to upstream.Generally, our upstream is fastcgi://127.0.0.1 :9000. There are roughly three reasons for this problem

php-fpm is not installed

This is the case with the newly purchased Alibaba Cloud server. There is nginx, but php-fpm is not installed

In this case, please refer to

centos to install php php-fpm and configure nginx

php-fpm is not running

Execute the following command to check whether php-fpm is started, if not, start yours Just php-fpm

netstat -ant | grep 9000

sudo /usr/local/php/sbin/php-fpm  


php-fpm queue is full

php-fpm.conf configuration filepm.max_children should be changed to a larger size, restart php-fpm and observe Log status

The above introduces the solution to the problem----connect() failed (111: Connection refused) while connecting to upstream, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php—Smarty-3 (20)Next article:php—Smarty-3 (20)